Skip to content

Commit

Permalink
Strict null check configureSnippets
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Nov 19, 2018
1 parent 0e4d94e commit 848010a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/tsconfig.strictNullChecks.json
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@
"./vs/workbench/parts/scm/electron-browser/scmUtil.ts",
"./vs/workbench/parts/search/common/constants.ts",
"./vs/workbench/parts/search/common/queryBuilder.ts",
"./vs/workbench/parts/snippets/electron-browser/configureSnippets.ts",
"./vs/workbench/parts/snippets/electron-browser/snippetCompletionProvider.ts",
"./vs/workbench/parts/snippets/electron-browser/snippets.contribution.ts",
"./vs/workbench/parts/snippets/electron-browser/snippetsFile.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ async function computePicks(snippetService: ISnippetsService, envService: IEnvir
outer: for (const snippet of file.data) {
for (const scope of snippet.scopes) {
const name = modeService.getLanguageName(scope);
if (names.size >= 4) {
names.add(`${name}...`);
break outer;
} else {
names.add(name);
if (name) {
if (names.size >= 4) {
names.add(`${name}...`);
break outer;
} else {
names.add(name);
}
}
}
}
Expand Down Expand Up @@ -158,6 +160,7 @@ async function createGlobalSnippetFile(defaultPath: URI, windowService: IWindowS
].join('\n'));

await opener.open(resource);
return undefined;
}

async function createLanguageSnippetFile(pick: ISnippetPick, fileService: IFileService) {
Expand Down Expand Up @@ -218,7 +221,7 @@ CommandsRegistry.registerCommand(id, async accessor => {
existing.push({ type: 'separator', label: nls.localize('new.global.sep', "New Snippets") });
}

const pick = await quickInputService.pick(<(IQuickPickItem | ISnippetPick | GlobalSnippetPick)[]>[].concat(existing, globalSnippetPicks, picks.future), {
const pick = await quickInputService.pick(([] as QuickPickInput[]).concat(existing, globalSnippetPicks, picks.future), {
placeHolder: nls.localize('openSnippet.pickLanguage', "Select Snippets File or Create Snippets"),
matchOnDescription: true
});
Expand Down

0 comments on commit 848010a

Please sign in to comment.