Skip to content

Commit c90f92f

Browse files
committed
Strict null check tabCompletions
1 parent a62b481 commit c90f92f

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/tsconfig.strictNullChecks.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@
671671
"./vs/workbench/parts/snippets/electron-browser/snippets.contribution.ts",
672672
"./vs/workbench/parts/snippets/electron-browser/snippetsFile.ts",
673673
"./vs/workbench/parts/snippets/electron-browser/snippetsService.ts",
674+
"./vs/workbench/parts/snippets/electron-browser/tabCompletion.ts",
674675
"./vs/workbench/parts/snippets/test/electron-browser/snippetFile.test.ts",
675676
"./vs/workbench/parts/snippets/test/electron-browser/snippetsRegistry.test.ts",
676677
"./vs/workbench/parts/snippets/test/electron-browser/snippetsRewrite.test.ts",
@@ -812,6 +813,7 @@
812813
"./vs/workbench/services/keybinding/test/macLinuxFallbackKeyboardMapper.test.ts",
813814
"./vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts",
814815
"./vs/workbench/services/keybinding/test/windowsKeyboardMapper.test.ts",
816+
"./vs/workbench/services/label/common/labelService.ts",
815817
"./vs/workbench/services/mode/common/workbenchModeService.ts",
816818
"./vs/workbench/services/notification/common/notificationService.ts",
817819
"./vs/workbench/services/panel/common/panelService.ts",

src/vs/workbench/parts/snippets/electron-browser/tabCompletion.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ export class TabCompletionController implements editorCommon.IEditorContribution
7878
// reset first
7979
this._activeSnippets = [];
8080

81+
if (!this._editor.hasModel()) {
82+
return;
83+
}
84+
8185
// lots of dance for getting the
8286
const selection = this._editor.getSelection();
8387
const model = this._editor.getModel();
@@ -118,6 +122,9 @@ export class TabCompletionController implements editorCommon.IEditorContribution
118122
}
119123

120124
performSnippetCompletions(): void {
125+
if (!this._editor.hasModel()) {
126+
return;
127+
}
121128

122129
if (this._activeSnippets.length === 1) {
123130
// one -> just insert
@@ -126,8 +133,8 @@ export class TabCompletionController implements editorCommon.IEditorContribution
126133

127134
} else if (this._activeSnippets.length > 1) {
128135
// two or more -> show IntelliSense box
136+
const position = this._editor.getPosition();
129137
showSimpleSuggestions(this._editor, this._activeSnippets.map(snippet => {
130-
const position = this._editor.getPosition();
131138
const range = Range.fromPositions(position.delta(0, -snippet.prefix.length), position);
132139
return new SnippetCompletion(snippet, range);
133140
}));

0 commit comments

Comments
 (0)