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:
Rhitik Bhatt 2020-06-15 18:57:40 +00:00 committed by GitHub
parent b95c7252d1
commit 4dfc14b846
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View file

@ -31,7 +31,7 @@ const jsTsLanguageConfiguration: vscode.LanguageConfiguration = {
}, {
// e.g. * ...|
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
oneLineAboveText: /(?=^(\s*(\/\*\*|\*)).*)(?=(?!(\s*\*\/)))/,
action: { indentAction: vscode.IndentAction.None, appendText: '* ' },
}, {
// e.g. */|

View file

@ -18,7 +18,7 @@ export const javascriptOnEnterRules = [
}, {
// e.g. * ...|
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
oneLineAboveText: /(?=^(\s*(\/\*\*|\*)).*)(?=(?!(\s*\*\/)))/,
action: { indentAction: IndentAction.None, appendText: '* ' }
}, {
// e.g. */|

View file

@ -118,6 +118,7 @@ suite('OnEnter', () => {
testIndentAction(' *', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
testIndentAction('', ' */', '', IndentAction.None, null, 1);
testIndentAction(' */', ' * test() {', '', IndentAction.Indent, null, 0);
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
testIndentAction('', '\t\t */', '', IndentAction.None, null, 1);
testIndentAction('', ' */', '', IndentAction.None, null, 1);