mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 11:08:31 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { getLocation, Location, parse } from 'jsonc-parser';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { provideInstalledExtensionProposals, provideWorkspaceTrustExtensionProposals } from './extensionsProposals';
|
||||
import { provideInstalledExtensionProposals } from './extensionsProposals';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -60,13 +60,9 @@ export class SettingsDocument {
|
||||
return provideInstalledExtensionProposals(alreadyConfigured, `: [\n\t"ui"\n]`, range, true);
|
||||
}
|
||||
|
||||
// extensions.supportUntrustedWorkspaces
|
||||
if (location.path[0] === 'extensions.supportUntrustedWorkspaces' && location.path.length === 2 && location.isAtPropertyKey) {
|
||||
let alreadyConfigured: string[] = [];
|
||||
try {
|
||||
alreadyConfigured = Object.keys(parse(this.document.getText())['extensions.supportUntrustedWorkspaces']);
|
||||
} catch (e) {/* ignore error */ }
|
||||
return provideWorkspaceTrustExtensionProposals(alreadyConfigured, range);
|
||||
// remote.portsAttributes
|
||||
if (location.path[0] === 'remote.portsAttributes' && location.path.length === 2 && location.isAtPropertyKey) {
|
||||
return this.providePortsAttributesCompletionItem(range);
|
||||
}
|
||||
|
||||
return this.provideLanguageOverridesCompletionItems(location, position);
|
||||
@@ -247,6 +243,31 @@ export class SettingsDocument {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
private providePortsAttributesCompletionItem(range: vscode.Range): vscode.CompletionItem[] {
|
||||
return [this.newSnippetCompletionItem(
|
||||
{
|
||||
label: '\"3000\"',
|
||||
documentation: 'Single Port Attribute',
|
||||
range,
|
||||
snippet: '\n \"${1:3000}\": {\n \"label\": \"${2:Application}\",\n \"onAutoForward\": \"${3:openPreview}\"\n }\n'
|
||||
}),
|
||||
this.newSnippetCompletionItem(
|
||||
{
|
||||
label: '\"5000-6000\"',
|
||||
documentation: 'Ranged Port Attribute',
|
||||
range,
|
||||
snippet: '\n \"${1:40000-55000}\": {\n \"onAutoForward\": \"${2:ignore}\"\n }\n'
|
||||
}),
|
||||
this.newSnippetCompletionItem(
|
||||
{
|
||||
label: '\".+\\\\/server.js\"',
|
||||
documentation: 'Command Match Port Attribute',
|
||||
range,
|
||||
snippet: '\n \"${1:.+\\\\/server.js\}\": {\n \"label\": \"${2:Application}\",\n \"onAutoForward\": \"${3:openPreview}\"\n }\n'
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
private newSimpleCompletionItem(text: string, range: vscode.Range, description?: string, insertText?: string): vscode.CompletionItem {
|
||||
const item = new vscode.CompletionItem(text);
|
||||
item.kind = vscode.CompletionItemKind.Value;
|
||||
|
||||
Reference in New Issue
Block a user