提交 0a1e2c29 编写于 作者: A Alex Dima

Fixes #1609: Tweak onEnter regexp to accept no trailing whitespace in doc comments

上级 b36f7f9c
......@@ -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: '* ' }
},
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册