From 6bfc7ee2b5b987f891d29e8147df475bb9e7c458 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Fri, 26 Jan 2018 17:26:54 +0100 Subject: [PATCH] strange intellisense suggestion in settings.json. Fixes #41732 --- .../src/settingsDocumentHelper.ts | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/extensions/configuration-editing/src/settingsDocumentHelper.ts b/extensions/configuration-editing/src/settingsDocumentHelper.ts index 5f9cc61c9a9..73de7fef8a8 100644 --- a/extensions/configuration-editing/src/settingsDocumentHelper.ts +++ b/extensions/configuration-editing/src/settingsDocumentHelper.ts @@ -60,26 +60,26 @@ export class SettingsDocument { private provideFilesAssociationsCompletionItems(location: Location, range: vscode.Range): vscode.ProviderResult { const completions: vscode.CompletionItem[] = []; - // Key - if (location.path.length === 1) { - completions.push(this.newSnippetCompletionItem({ - label: localize('assocLabelFile', "Files with Extension"), - documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given identifier."), - snippet: location.isAtPropertyKey ? '"*.${1:extension}": "${2:language}"' : '{ "*.${1:extension}": "${2:language}" }', - range - })); - - completions.push(this.newSnippetCompletionItem({ - label: localize('assocLabelPath', "Files with Path"), - documentation: localize('assocDescriptionPath', "Map all files matching the absolute path glob pattern in their path to the language with the given identifier."), - snippet: location.isAtPropertyKey ? '"/${1:path to file}/*.${2:extension}": "${3:language}"' : '{ "/${1:path to file}/*.${2:extension}": "${3:language}" }', - range - })); - } - - // Value - else if (location.path.length === 2 && !location.isAtPropertyKey) { - return this.provideLanguageCompletionItems(location, range); + if (location.path.length === 2) { + // Key + if (!location.isAtPropertyKey || location.path[1] === '') { + completions.push(this.newSnippetCompletionItem({ + label: localize('assocLabelFile', "Files with Extension"), + documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given identifier."), + snippet: location.isAtPropertyKey ? '"*.${1:extension}": "${2:language}"' : '{ "*.${1:extension}": "${2:language}" }', + range + })); + + completions.push(this.newSnippetCompletionItem({ + label: localize('assocLabelPath', "Files with Path"), + documentation: localize('assocDescriptionPath', "Map all files matching the absolute path glob pattern in their path to the language with the given identifier."), + snippet: location.isAtPropertyKey ? '"/${1:path to file}/*.${2:extension}": "${3:language}"' : '{ "/${1:path to file}/*.${2:extension}": "${3:language}" }', + range + })); + } else { + // Value + return this.provideLanguageCompletionItems(location, range); + } } return Promise.resolve(completions); -- GitLab