fix $90348
This commit is contained in:
parent
cfa6daa6b9
commit
ff0de753f4
1 changed files with 8 additions and 3 deletions
|
@ -86,7 +86,7 @@ export class SettingsDocument {
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
// Value
|
// Value
|
||||||
return this.provideLanguageCompletionItems(location, range);
|
return this.provideLanguageCompletionItemsForLanguageOverrides(location, range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +158,11 @@ export class SettingsDocument {
|
||||||
}
|
}
|
||||||
|
|
||||||
private provideLanguageCompletionItems(_location: Location, range: vscode.Range, formatFunc: (string: string) => string = (l) => JSON.stringify(l)): Thenable<vscode.CompletionItem[]> {
|
private provideLanguageCompletionItems(_location: Location, range: vscode.Range, formatFunc: (string: string) => string = (l) => JSON.stringify(l)): Thenable<vscode.CompletionItem[]> {
|
||||||
|
return vscode.languages.getLanguages()
|
||||||
|
.then(languages => languages.map(l => this.newSimpleCompletionItem(formatFunc(l), range)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private provideLanguageCompletionItemsForLanguageOverrides(_location: Location, range: vscode.Range, formatFunc: (string: string) => string = (l) => JSON.stringify(l)): Thenable<vscode.CompletionItem[]> {
|
||||||
return vscode.languages.getLanguages().then(languages => {
|
return vscode.languages.getLanguages().then(languages => {
|
||||||
const completionItems = [];
|
const completionItems = [];
|
||||||
const configuration = vscode.workspace.getConfiguration();
|
const configuration = vscode.workspace.getConfiguration();
|
||||||
|
@ -182,7 +187,7 @@ export class SettingsDocument {
|
||||||
let text = this.document.getText(range);
|
let text = this.document.getText(range);
|
||||||
if (text && text.trim().startsWith('[')) {
|
if (text && text.trim().startsWith('[')) {
|
||||||
range = new vscode.Range(new vscode.Position(range.start.line, range.start.character + text.indexOf('[')), range.end);
|
range = new vscode.Range(new vscode.Position(range.start.line, range.start.character + text.indexOf('[')), range.end);
|
||||||
return this.provideLanguageCompletionItems(location, range, language => `"[${language}]"`);
|
return this.provideLanguageCompletionItemsForLanguageOverrides(location, range, language => `"[${language}]"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
range = this.document.getWordRangeAtPosition(position) || new vscode.Range(position, position);
|
range = this.document.getWordRangeAtPosition(position) || new vscode.Range(position, position);
|
||||||
|
@ -209,7 +214,7 @@ export class SettingsDocument {
|
||||||
// Suggestion model word matching includes closed sqaure bracket and ending quote
|
// Suggestion model word matching includes closed sqaure bracket and ending quote
|
||||||
// Hence include them in the proposal to replace
|
// Hence include them in the proposal to replace
|
||||||
let range = this.document.getWordRangeAtPosition(position) || new vscode.Range(position, position);
|
let range = this.document.getWordRangeAtPosition(position) || new vscode.Range(position, position);
|
||||||
return this.provideLanguageCompletionItems(location, range, language => `"[${language}]"`);
|
return this.provideLanguageCompletionItemsForLanguageOverrides(location, range, language => `"[${language}]"`);
|
||||||
}
|
}
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue