strange intellisense suggestion in settings.json. Fixes #41732

This commit is contained in:
Martin Aeschlimann 2018-01-26 17:26:54 +01:00
parent f43d42499a
commit 6bfc7ee2b5

View file

@ -60,26 +60,26 @@ export class SettingsDocument {
private provideFilesAssociationsCompletionItems(location: Location, range: vscode.Range): vscode.ProviderResult<vscode.CompletionItem[]> { private provideFilesAssociationsCompletionItems(location: Location, range: vscode.Range): vscode.ProviderResult<vscode.CompletionItem[]> {
const completions: vscode.CompletionItem[] = []; const completions: vscode.CompletionItem[] = [];
// Key if (location.path.length === 2) {
if (location.path.length === 1) { // Key
completions.push(this.newSnippetCompletionItem({ if (!location.isAtPropertyKey || location.path[1] === '') {
label: localize('assocLabelFile', "Files with Extension"), completions.push(this.newSnippetCompletionItem({
documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given identifier."), label: localize('assocLabelFile', "Files with Extension"),
snippet: location.isAtPropertyKey ? '"*.${1:extension}": "${2:language}"' : '{ "*.${1:extension}": "${2:language}" }', documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given identifier."),
range snippet: location.isAtPropertyKey ? '"*.${1:extension}": "${2:language}"' : '{ "*.${1:extension}": "${2:language}" }',
})); range
}));
completions.push(this.newSnippetCompletionItem({ completions.push(this.newSnippetCompletionItem({
label: localize('assocLabelPath', "Files with Path"), 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."), 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}" }', snippet: location.isAtPropertyKey ? '"/${1:path to file}/*.${2:extension}": "${3:language}"' : '{ "/${1:path to file}/*.${2:extension}": "${3:language}" }',
range range
})); }));
} } else {
// Value
// Value return this.provideLanguageCompletionItems(location, range);
else if (location.path.length === 2 && !location.isAtPropertyKey) { }
return this.provideLanguageCompletionItems(location, range);
} }
return Promise.resolve(completions); return Promise.resolve(completions);