Fixes buggy onEnter behavior when used with generator method (#100076)
* Adds regex to ignore already closed comment block * Adds test case for generator method onEnter buggy behavior
This commit is contained in:
parent
b95c7252d1
commit
4dfc14b846
|
@ -31,7 +31,7 @@ const jsTsLanguageConfiguration: vscode.LanguageConfiguration = {
|
||||||
}, {
|
}, {
|
||||||
// e.g. * ...|
|
// e.g. * ...|
|
||||||
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
|
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
|
||||||
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
|
oneLineAboveText: /(?=^(\s*(\/\*\*|\*)).*)(?=(?!(\s*\*\/)))/,
|
||||||
action: { indentAction: vscode.IndentAction.None, appendText: '* ' },
|
action: { indentAction: vscode.IndentAction.None, appendText: '* ' },
|
||||||
}, {
|
}, {
|
||||||
// e.g. */|
|
// e.g. */|
|
||||||
|
|
|
@ -18,7 +18,7 @@ export const javascriptOnEnterRules = [
|
||||||
}, {
|
}, {
|
||||||
// e.g. * ...|
|
// e.g. * ...|
|
||||||
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
|
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
|
||||||
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
|
oneLineAboveText: /(?=^(\s*(\/\*\*|\*)).*)(?=(?!(\s*\*\/)))/,
|
||||||
action: { indentAction: IndentAction.None, appendText: '* ' }
|
action: { indentAction: IndentAction.None, appendText: '* ' }
|
||||||
}, {
|
}, {
|
||||||
// e.g. */|
|
// e.g. */|
|
||||||
|
|
|
@ -118,6 +118,7 @@ suite('OnEnter', () => {
|
||||||
testIndentAction(' *', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
|
testIndentAction(' *', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
|
||||||
|
|
||||||
testIndentAction('', ' */', '', IndentAction.None, null, 1);
|
testIndentAction('', ' */', '', IndentAction.None, null, 1);
|
||||||
|
testIndentAction(' */', ' * test() {', '', IndentAction.Indent, null, 0);
|
||||||
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
|
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
|
||||||
testIndentAction('', '\t\t */', '', IndentAction.None, null, 1);
|
testIndentAction('', '\t\t */', '', IndentAction.None, null, 1);
|
||||||
testIndentAction('', ' */', '', IndentAction.None, null, 1);
|
testIndentAction('', ' */', '', IndentAction.None, null, 1);
|
||||||
|
|
Loading…
Reference in a new issue