mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Fix #27800
This commit is contained in:
parent
112a20a1c0
commit
1716eaae4e
|
@ -9,6 +9,9 @@ import * as vscode from 'vscode';
|
|||
import { getLocation, visit, parse } from 'jsonc-parser';
|
||||
import * as path from 'path';
|
||||
import { SettingsDocument } from './settingsDocumentHelper';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
const decoration = vscode.window.createTextEditorDecorationType({
|
||||
color: '#b1b1b1'
|
||||
|
@ -73,13 +76,12 @@ function registerExtensionsCompletions(): vscode.Disposable {
|
|||
const config = parse(document.getText());
|
||||
const alreadyEnteredExtensions = config && config.recommendations || [];
|
||||
if (Array.isArray(alreadyEnteredExtensions)) {
|
||||
return vscode.extensions.all
|
||||
.filter(e => !(
|
||||
e.id.startsWith('vscode.')
|
||||
const knownExtensionProposals = vscode.extensions.all.filter(e =>
|
||||
!(e.id.startsWith('vscode.')
|
||||
|| e.id === 'Microsoft.vscode-markdown'
|
||||
|| alreadyEnteredExtensions.indexOf(e.id) > -1
|
||||
))
|
||||
.map(e => {
|
||||
|| alreadyEnteredExtensions.indexOf(e.id) > -1));
|
||||
if (knownExtensionProposals.length) {
|
||||
return knownExtensionProposals.map(e => {
|
||||
const item = new vscode.CompletionItem(e.id);
|
||||
const insertText = `"${e.id}"`;
|
||||
item.kind = vscode.CompletionItemKind.Value;
|
||||
|
@ -88,6 +90,13 @@ function registerExtensionsCompletions(): vscode.Disposable {
|
|||
item.filterText = insertText;
|
||||
return item;
|
||||
});
|
||||
} else {
|
||||
const example = new vscode.CompletionItem(localize('exampleExtension', "Example"));
|
||||
example.insertText = '"vscode.csharp"';
|
||||
example.kind = vscode.CompletionItemKind.Value;
|
||||
example.range = range;
|
||||
return [example];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [];
|
||||
|
|
|
@ -18,7 +18,6 @@ export const ExtensionsConfigurationSchema: IJSONSchema = {
|
|||
description: localize('app.extensions.json.recommendations', "List of extensions recommendations. The identifier of an extension is always '${publisher}.${name}'. For example: 'vscode.csharp'."),
|
||||
items: {
|
||||
type: 'string',
|
||||
defaultSnippets: [{ label: 'Example', body: 'vscode.csharp' }],
|
||||
pattern: EXTENSION_IDENTIFIER_PATTERN,
|
||||
errorMessage: localize('app.extension.identifier.errorMessage', "Expected format '${publisher}.${name}'. Example: 'vscode.csharp'.")
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue