mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 05:51:32 +01:00
have intellisense for modes
This commit is contained in:
@@ -13,18 +13,20 @@ import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
let globProperties: CompletionItem[] = [
|
||||
{ kind: CompletionItemKind.Value, label: localize('assocLabel', "Files with Extension"), insertText: '"*.{{extension}}": "{{language}}"', documentation: localize('assocDescription', "Map all files matching the given pattern to the language with the given id.") },
|
||||
];
|
||||
|
||||
let globValues: CompletionItem[] = [
|
||||
{ kind: CompletionItemKind.Value, label: localize('languageId', "Language Identifier"), insertText: '"{{language}}"', documentation: localize('languageDescription', "The identifier of the language to associate with the file name pattern.") },
|
||||
{ kind: CompletionItemKind.Value, label: localize('assocLabelFile', "Files with Extension"), insertText: '"*.{{extension}}": "{{language}}"', documentation: localize('assocDescriptionFile', "Map all files matching the glob pattern in their filename to the language with the given id.") },
|
||||
{ kind: CompletionItemKind.Value, label: localize('assocLabelPath', "Files with Path"), insertText: '"{{folder}}/*.{{extension}}": "{{language}}"', documentation: localize('assocDescriptionPath', "Map all files matching the glob pattern in their full path to the language with the given id.") }
|
||||
];
|
||||
|
||||
export class FileAssociationContribution implements IJSONWorkerContribution {
|
||||
private languageIds:string[];
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
public setLanguageIds(ids:string[]): void {
|
||||
this.languageIds = ids;
|
||||
}
|
||||
|
||||
private isSettingsFile(resource: string): boolean {
|
||||
return Strings.endsWith(resource, '/settings.json');
|
||||
}
|
||||
@@ -43,7 +45,13 @@ export class FileAssociationContribution implements IJSONWorkerContribution {
|
||||
|
||||
public collectValueSuggestions(resource: string, location: JSONLocation, currentKey: string, result: ISuggestionsCollector): Thenable<any> {
|
||||
if (this.isSettingsFile(resource) && location.matches(['files.associations'])) {
|
||||
globValues.forEach((e) => result.add(e));
|
||||
this.languageIds.forEach(l => {
|
||||
result.add({
|
||||
kind: CompletionItemKind.Value,
|
||||
label: l,
|
||||
insertText: '"{{' + l + '}}"',
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user