Skip to content

Commit 4dfc14b

Browse files
authored
Fixes buggy onEnter behavior when used with generator method (microsoft#100076)
* Adds regex to ignore already closed comment block * Adds test case for generator method onEnter buggy behavior
1 parent b95c725 commit 4dfc14b

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

extensions/typescript-language-features/src/features/languageConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const jsTsLanguageConfiguration: vscode.LanguageConfiguration = {
3131
}, {
3232
// e.g. * ...|
3333
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
34-
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
34+
oneLineAboveText: /(?=^(\s*(\/\*\*|\*)).*)(?=(?!(\s*\*\/)))/,
3535
action: { indentAction: vscode.IndentAction.None, appendText: '* ' },
3636
}, {
3737
// e.g. */|

src/vs/editor/test/common/modes/supports/javascriptOnEnterRules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const javascriptOnEnterRules = [
1818
}, {
1919
// e.g. * ...|
2020
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
21-
oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
21+
oneLineAboveText: /(?=^(\s*(\/\*\*|\*)).*)(?=(?!(\s*\*\/)))/,
2222
action: { indentAction: IndentAction.None, appendText: '* ' }
2323
}, {
2424
// e.g. */|

src/vs/editor/test/common/modes/supports/onEnter.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ suite('OnEnter', () => {
118118
testIndentAction(' *', ' * asdfsfagadfg * / * / * /*', '', IndentAction.None, '* ');
119119

120120
testIndentAction('', ' */', '', IndentAction.None, null, 1);
121+
testIndentAction(' */', ' * test() {', '', IndentAction.Indent, null, 0);
121122
testIndentAction('', '\t */', '', IndentAction.None, null, 1);
122123
testIndentAction('', '\t\t */', '', IndentAction.None, null, 1);
123124
testIndentAction('', ' */', '', IndentAction.None, null, 1);

0 commit comments

Comments
 (0)