Update to @microsoft/compose-language-service@0.0.2-alpha (#3286)

This commit is contained in:
Brandon Waterloo [MSFT] 2021-11-01 15:42:08 -04:00 коммит произвёл GitHub
Родитель a6283269b9
Коммит 94d983af9a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 110 добавлений и 9 удалений

14
package-lock.json сгенерированный
Просмотреть файл

@ -15,7 +15,7 @@
"@azure/storage-blob": "^12.4.1",
"@docker/sdk": "^1.0.3",
"@grpc/grpc-js": "^1.2.12",
"@microsoft/compose-language-service": "^0.0.1-alpha",
"@microsoft/compose-language-service": "^0.0.2-alpha",
"dayjs": "^1.10.4",
"dockerfile-language-server-nodejs": "^0.7.2",
"dockerode": "^3.2.1",
@ -520,9 +520,9 @@
"dev": true
},
"node_modules/@microsoft/compose-language-service": {
"version": "0.0.1-alpha",
"resolved": "https://registry.npmjs.org/@microsoft/compose-language-service/-/compose-language-service-0.0.1-alpha.tgz",
"integrity": "sha512-MLJL+FOWUYQ/ggze8XTjidaDBSEMvd7Kt6Q6R4QQB16cmFWydqubaO8mftV+HPpQwtACYTjfQh84MUoYhJviPQ==",
"version": "0.0.2-alpha",
"resolved": "https://registry.npmjs.org/@microsoft/compose-language-service/-/compose-language-service-0.0.2-alpha.tgz",
"integrity": "sha512-6HSeq8dgVUM2eh2/anHamLKy/86MXNZ8iFTfxPnbJEHl+3ZBloc1N6WqRsIhlr9wriCKlnJQnu3tudJhsED9pA==",
"dependencies": {
"vscode-languageserver": "^7.0.0",
"vscode-languageserver-textdocument": "^1.0.1",
@ -6907,9 +6907,9 @@
"dev": true
},
"@microsoft/compose-language-service": {
"version": "0.0.1-alpha",
"resolved": "https://registry.npmjs.org/@microsoft/compose-language-service/-/compose-language-service-0.0.1-alpha.tgz",
"integrity": "sha512-MLJL+FOWUYQ/ggze8XTjidaDBSEMvd7Kt6Q6R4QQB16cmFWydqubaO8mftV+HPpQwtACYTjfQh84MUoYhJviPQ==",
"version": "0.0.2-alpha",
"resolved": "https://registry.npmjs.org/@microsoft/compose-language-service/-/compose-language-service-0.0.2-alpha.tgz",
"integrity": "sha512-6HSeq8dgVUM2eh2/anHamLKy/86MXNZ8iFTfxPnbJEHl+3ZBloc1N6WqRsIhlr9wriCKlnJQnu3tudJhsED9pA==",
"requires": {
"vscode-languageserver": "^7.0.0",
"vscode-languageserver-textdocument": "^1.0.1",

Просмотреть файл

@ -1465,6 +1465,18 @@
]
}
],
"configurationDefaults": {
"[dockercompose]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.autoIndent": "advanced",
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
}
}
},
"configuration": {
"title": "Docker",
"properties": {
@ -3039,7 +3051,7 @@
"@azure/storage-blob": "^12.4.1",
"@docker/sdk": "^1.0.3",
"@grpc/grpc-js": "^1.2.12",
"@microsoft/compose-language-service": "^0.0.1-alpha",
"@microsoft/compose-language-service": "^0.0.2-alpha",
"dayjs": "^1.10.4",
"dockerfile-language-server-nodejs": "^0.7.2",
"dockerode": "^3.2.1",

Просмотреть файл

@ -3,11 +3,12 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TelemetryEvent } from '@microsoft/compose-language-service/lib/client/TelemetryEvent';
import * as fse from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
import * as vscode from 'vscode';
import { callWithTelemetryAndErrorHandling, createAzExtOutputChannel, createExperimentationService, IActionContext, registerErrorHandler, registerReportIssueCommand, registerUIExtensionVariables, UserCancelledError } from 'vscode-azureextensionui';
import { callWithTelemetryAndErrorHandling, createAzExtOutputChannel, createExperimentationService, IActionContext, registerErrorHandler, registerEvent, registerReportIssueCommand, registerUIExtensionVariables, UserCancelledError } from 'vscode-azureextensionui';
import { ConfigurationParams, DidChangeConfigurationNotification, DocumentSelector, LanguageClient, LanguageClientOptions, Middleware, ServerOptions, TransportKind } from 'vscode-languageclient/node';
import * as tas from 'vscode-tas-client';
import { registerCommands } from './commands/registerCommands';
@ -23,6 +24,7 @@ import { registerListeners } from './telemetry/registerListeners';
import { registerTrees } from './tree/registerTrees';
import { AzureAccountExtensionListener } from './utils/AzureAccountExtensionListener';
import { cryptoUtils } from './utils/cryptoUtils';
import { DocumentSettingsClientFeature } from './utils/DocumentSettingsClientFeature';
import { isLinux, isMac, isWindows } from './utils/osUtils';
export type KeyInfo = { [keyName: string]: string };
@ -314,6 +316,17 @@ function activateComposeLanguageClient(ctx: vscode.ExtensionContext): void {
clientOptions
);
client.registerProposedFeatures();
client.registerFeature(new DocumentSettingsClientFeature(client));
registerEvent('compose-langserver-event', client.onTelemetry, (context: IActionContext, evtArgs: TelemetryEvent) => {
context.telemetry.properties.langServerEventName = evtArgs.eventName;
context.telemetry.suppressAll = evtArgs.suppressAll;
context.telemetry.suppressIfSuccessful = evtArgs.suppressIfSuccessful;
Object.assign(context.telemetry.measurements, evtArgs.measurements);
Object.assign(context.telemetry.properties, evtArgs.properties);
});
ctx.subscriptions.push(client.start());
});
}

Просмотреть файл

@ -0,0 +1,71 @@
/*!--------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// Largely copied from https://github.com/microsoft/compose-language-service/blob/main/src/test/clientExtension/DocumentSettingsClientFeature.ts
import * as vscode from 'vscode';
import { ClientCapabilities, StaticFeature } from 'vscode-languageclient';
import { LanguageClient } from 'vscode-languageclient/node';
import { DocumentSettings, DocumentSettingsNotificationParams, DocumentSettingsParams, DocumentSettingsNotification, DocumentSettingsRequest } from '@microsoft/compose-language-service/lib/client/DocumentSettings';
/**
* This class implements functionality to allow the language server to request information about an open document (including tab size and line endings), and also
* notify the language server if those settings change
*/
export class DocumentSettingsClientFeature implements StaticFeature, vscode.Disposable {
private disposables: vscode.Disposable[] = [];
public constructor(private readonly client: LanguageClient) { }
public fillClientCapabilities(capabilities: ClientCapabilities): void {
const documentSettings = {
notify: true,
request: true,
};
capabilities.experimental = {
...capabilities.experimental,
documentSettings,
};
}
public initialize(): void {
this.disposables.push(
this.client.onRequest(
DocumentSettingsRequest.method,
(params: DocumentSettingsParams): DocumentSettings | undefined => {
const textEditor = vscode.window.visibleTextEditors.find(e => e.document.uri.toString() === params.textDocument.uri);
if (!textEditor) {
return undefined;
}
return {
eol: textEditor.document.eol,
tabSize: Number(textEditor.options.tabSize),
};
}
)
);
this.disposables.push(
vscode.window.onDidChangeTextEditorOptions(
(e: vscode.TextEditorOptionsChangeEvent) => {
const params: DocumentSettingsNotificationParams = {
textDocument: { uri: e.textEditor.document.uri.toString() },
eol: e.textEditor.document.eol,
tabSize: Number(e.options.tabSize),
};
this.client.sendNotification(DocumentSettingsNotification.method, params);
}
)
);
}
public dispose(): void {
this.disposables.forEach(d => d.dispose());
}
}

Просмотреть файл

@ -109,6 +109,11 @@ const config = {
module: /node_modules\/vscode-extension-telemetry/,
message: /Can't resolve 'applicationinsights-native-metrics'/
},
{
// Ignore a warning for missing optional dependency of `ssh2`
module: /node_modules\/ssh2/,
message: /Can't resolve 'cpu-features'/
},
(warning) => false, // No other warnings should be ignored
],
};