Fixes #1609: Tweak onEnter regexp to accept no trailing whitespace in doc comments
This commit is contained in:
parent
b36f7f9c3c
commit
0a1e2c29b0
5 changed files with 31 additions and 6 deletions
|
@ -100,7 +100,7 @@ function registerSupports(modeID: string, host: TypeScriptServiceClientHost, cli
|
|||
},
|
||||
{
|
||||
// e.g. * ...|
|
||||
beforeText: /^(\t|(\ \ ))*\ \*\ ([^\*]|\*(?!\/))*$/,
|
||||
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
||||
action: { indentAction: IndentAction.None, appendText: '* ' }
|
||||
},
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ class DocBlockCommentMode implements Modes.IMode {
|
|||
},
|
||||
{
|
||||
// e.g. * ...|
|
||||
beforeText: /^(\t|(\ \ ))*\ \*\ ([^\*]|\*(?!\/))*$/,
|
||||
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
||||
action: { indentAction: Modes.IndentAction.None, appendText: '* ' }
|
||||
},
|
||||
{
|
||||
|
@ -591,6 +591,31 @@ suite('Editor Commands - ShiftCommand', () => {
|
|||
);
|
||||
});
|
||||
|
||||
test('issue #1609: Wrong indentation of block comments', () => {
|
||||
testShiftCommandInDocBlockCommentMode(
|
||||
[
|
||||
'',
|
||||
'/**',
|
||||
' * test',
|
||||
' *',
|
||||
' * @type {number}',
|
||||
' */',
|
||||
'var foo = 0;'
|
||||
],
|
||||
new Selection(1,1,7,13),
|
||||
[
|
||||
'',
|
||||
'\t/**',
|
||||
'\t * test',
|
||||
'\t *',
|
||||
'\t * @type {number}',
|
||||
'\t */',
|
||||
'\tvar foo = 0;'
|
||||
],
|
||||
new Selection(1,1,7,14)
|
||||
);
|
||||
});
|
||||
|
||||
test('bug #16815:Shift+Tab doesn\'t go back to tabstop', () => {
|
||||
|
||||
var repeatStr = (str:string, cnt:number): string => {
|
||||
|
|
|
@ -87,7 +87,7 @@ suite('OnEnter', () => {
|
|||
action: { indentAction: IndentAction.None, appendText: ' * ' }
|
||||
},
|
||||
{
|
||||
beforeText: /^(\t|(\ \ ))*\ \*\ ([^\*]|\*(?!\/))*$/,
|
||||
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
||||
action: { indentAction: IndentAction.None, appendText: '* ' }
|
||||
},
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ suite('OnEnter', () => {
|
|||
testIndentAction('*/', '', null, null);
|
||||
testIndentAction('\t/*', '', null, null);
|
||||
testIndentAction('\t*', '', null, null);
|
||||
testIndentAction('\t *', '', null, null);
|
||||
testIndentAction('\t *', '', IndentAction.None, '* ');
|
||||
testIndentAction('\t */', '', IndentAction.None, null, 1);
|
||||
testIndentAction('\t * */', '', null, null);
|
||||
testIndentAction('\t * * / * / * / */', '', null, null);
|
||||
|
|
|
@ -91,7 +91,7 @@ export class JSMode extends typescriptMode.TypeScriptMode<javascriptWorker.JavaS
|
|||
},
|
||||
{
|
||||
// e.g. * ...|
|
||||
beforeText: /^(\t|(\ \ ))*\ \*\ ([^\*]|\*(?!\/))*$/,
|
||||
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
||||
action: { indentAction: Modes.IndentAction.None, appendText: '* ' }
|
||||
},
|
||||
{
|
||||
|
|
|
@ -253,7 +253,7 @@ export class TypeScriptMode<W extends typescriptWorker.TypeScriptWorker2> extend
|
|||
},
|
||||
{
|
||||
// e.g. * ...|
|
||||
beforeText: /^(\t|(\ \ ))*\ \*\ ([^\*]|\*(?!\/))*$/,
|
||||
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
||||
action: { indentAction: Modes.IndentAction.None, appendText: '* ' }
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue