mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Fix #44187
This commit is contained in:
parent
0e9649f0ae
commit
03f92dde0a
|
@ -7,7 +7,7 @@
|
|||
import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
import * as vscode from 'vscode';
|
||||
import { getLocation, visit, parse, ParseError, ParseErrorCode } from 'jsonc-parser';
|
||||
import { getLocation, visit, parse, ParseErrorCode } from 'jsonc-parser';
|
||||
import * as path from 'path';
|
||||
import { SettingsDocument } from './settingsDocumentHelper';
|
||||
|
||||
|
@ -70,8 +70,6 @@ function autoFixSettingsJSON(willSaveEvent: vscode.TextDocumentWillSaveEvent): v
|
|||
|
||||
onError(error: ParseErrorCode, offset: number, length: number): void {
|
||||
if (error === ParseErrorCode.CommaExpected && lastEndOfSomething > -1) {
|
||||
const errorPosition = document.positionAt(offset);
|
||||
|
||||
const fixPosition = document.positionAt(lastEndOfSomething);
|
||||
edit.insert(document.uri, fixPosition, ',');
|
||||
}
|
||||
|
@ -106,30 +104,6 @@ function registerSettingsCompletions(): vscode.Disposable {
|
|||
});
|
||||
}
|
||||
|
||||
function provideContributedLocalesProposals(range: vscode.Range): vscode.ProviderResult<vscode.CompletionItem[] | vscode.CompletionList> {
|
||||
const contributedLocales: string[] = [];
|
||||
for (const extension of vscode.extensions.all) {
|
||||
if (extension.packageJSON && extension.packageJSON['contributes'] && extension.packageJSON['contributes']['localizations'] && extension.packageJSON['contributes']['localizations'].length) {
|
||||
const localizations: { languageId: string }[] = extension.packageJSON['contributes']['localizations'];
|
||||
for (const localization of localizations) {
|
||||
if (contributedLocales.indexOf(localization.languageId) === -1) {
|
||||
contributedLocales.push(localization.languageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return contributedLocales.map(locale => {
|
||||
const text = `"${locale}"`;
|
||||
const item = new vscode.CompletionItem(text);
|
||||
item.kind = vscode.CompletionItemKind.Value;
|
||||
item.insertText = text;
|
||||
item.range = range;
|
||||
item.filterText = text;
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
interface IExtensionsContent {
|
||||
recommendations: string[];
|
||||
}
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
"lib": [
|
||||
"es2015"
|
||||
],
|
||||
"strict": true
|
||||
"strict": true,
|
||||
"noUnusedLocals": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue