WIP: update to new @microsoft/vscode-azext-utils (#1786)

* switch to @microsoft/vscode-azext-utils

* force rebuild

* Fix aiKey
This commit is contained in:
Stephen Weatherford (MSFT) 2024-11-08 10:42:44 -08:00 коммит произвёл GitHub
Родитель 90e9c7316d
Коммит 403a527df0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
48 изменённых файлов: 3348 добавлений и 17482 удалений

4
.vscode/launch.json поставляемый
Просмотреть файл

@ -99,7 +99,7 @@
],
"preLaunchTask": "npm: pretest-dev",
"env": {
"MOCHA_grep": "", // RegExp of tests to run (empty for all) -- affects F5 only asdfg?
"MOCHA_grep": "", // RegExp of tests to run (empty for all) -- affects F5 only
"MOCHA_invert": "0", // Invert the RegExp
"MOCHA_bail": "0", // Bail after first failure
"MOCHA_enableTimeouts": "0", // Disable time-outs
@ -129,7 +129,7 @@
],
"preLaunchTask": "npm: pretest-prod",
"env": {
"MOCHA_grep": "", // RegExp of tests to run (empty for all) -- works for F5 only asdfg?
"MOCHA_grep": "", // RegExp of tests to run (empty for all) -- works for F5 only
"MOCHA_invert": "0", // Invert the RegExp
"MOCHA_bail": "0", // Bail after first failure
"MOCHA_enableTimeouts": "0", // Disable time-outs

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

@ -5,6 +5,7 @@
// tslint:disable:no-unsafe-any no-console prefer-template no-implicit-dependencies export-name
import { gulp_webpack } from '@microsoft/vscode-azext-dev';
import { downloadAndUnzipVSCode, resolveCliArgsFromVSCodeExecutablePath } from '@vscode/test-electron';
import * as assert from 'assert';
import * as cp from 'child_process';
@ -16,7 +17,6 @@ import * as process from 'process';
import * as recursiveReadDir from 'recursive-readdir';
import * as rimraf from 'rimraf';
import * as shelljs from 'shelljs';
import { gulp_webpack } from 'vscode-azureextensiondev';
import { DEFAULT_TESTCASE_TIMEOUT_MS, langServerDotnetVersion, languageServerFolderName } from './common';
import { getTempFilePath } from './test/support/getTempFilePath';
@ -113,7 +113,7 @@ async function pretest(): Promise<void> {
shell: true,
});
if (result.status !== 0) {
throw new Error("Failed to install dotnet runtime extension: " + result.error ?? result.output?.filter((o) => !!o).join("\n") ?? "Unknown error");
throw new Error("Failed to install dotnet runtime extension: " + (result.error ?? result.output?.filter((o) => !!o).join("\n") ?? "Unknown error"));
}
console.log("Installed extensions:");
result = cp.spawnSync(cliPath, [

20632
package-lock.json сгенерированный

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -40,7 +40,7 @@
"homepage": "https://github.com/Microsoft/vscode-azurearmtools/blob/main/README.md",
"license": "SEE LICENSE IN LICENSE.md",
"icon": "AzureRMTools128x128.png",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",
"engines": {
"$comment": "Must match version of @types/vscode in devDepndencies",
"vscode": "^1.62.0"
@ -637,21 +637,25 @@
"$devDependencies.comment": "@types/estree is to fix eslint issue, see https://stackoverflow.com/questions/67806963/types-eslint-error-chainexpression-and-importexpression-members-of-estree-not#:~:text=Solution%20to%20this%20problem%20is%3A%20npm%20install%20--save-dev,again%3A%20npm%20install%20Errors%20should%20be%20gone%20now.",
"devDependencies": {
"@types/decompress": "^4.2.3",
"@types/estree": "^1.0.1",
"@types/estree": "^1.0.6",
"@types/fs-extra": "^5.1.0",
"@types/gulp": "^4.0.13",
"@types/mocha": "^10.0.1",
"@types/node": "^14.14.24",
"@types/gulp": "^4.0.17",
"@types/mocha": "^10.0.9",
"@types/node": "^22.9.0",
"@types/recursive-readdir": "^2.2.1",
"@types/rimraf": "2.0.2",
"@types/shelljs": "0.8.12",
"@types/shelljs": "0.8.15",
"@types/vscode": "^1.62.0",
"@types/webpack": "^4.41.26",
"@types/vinyl": "^2.0.12",
"@types/webpack": "^5.28.5",
"@vscode/test-cli": "0.0.10",
"@vscode/test-electron": "^2.4.1",
"@microsoft/vscode-azext-dev": "^2.0.6",
"chokidar": "4.0.1",
"crypto": "^1.0.1",
"glob": "^7.2.3",
"glob-promise": "^4.2.2",
"gulp": "^4.0.2",
"gulp": "^5.0.0",
"mocha": "^10.2.0",
"mocha-junit-reporter": "^2.2.1",
"mocha-multi-reporters": "^1.5.1",
@ -661,17 +665,16 @@
"shelljs": "^0.8.5",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typescript": "^3.8.3",
"typescript": "^5.0.3",
"vsce": "^1.87.0",
"vscode-azureextensiondev": "^0.5.0",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
"webpack": "^5.74.0",
"webpack-cli": "^4.6.0"
},
"dependencies": {
"@microsoft/vscode-azext-utils": "^2.0.0",
"fs-extra": "^10.1.0",
"moment": "^2.29.4",
"strip-json-comments": "^3.1.1",
"vscode-azureextensionui": "^0.39.7",
"vscode-jsonrpc": "^8.1.0",
"vscode-languageclient": "^7.0.0"
},

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

@ -2,8 +2,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
import { callWithTelemetryAndErrorHandling, IActionContext } from "@microsoft/vscode-azext-utils";
import { commands, MessageItem, Uri, window } from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext } from "vscode-azureextensionui";
import { ext } from "./extensionVariables";
import { assert } from './fixed_assert';
import { minutesToMs, weeksToMs } from "./util/time";

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

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { callWithTelemetryAndErrorHandling, IActionContext, parseError } from "@microsoft/vscode-azext-utils";
import { commands } from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext, parseError } from 'vscode-azureextensionui';
import { ext } from '../extensionVariables';
import { wrapError } from '../util/wrapError';

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

@ -2,10 +2,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
import { IActionContext, UserCancelledError } from "@microsoft/vscode-azext-utils";
import * as fse from 'fs-extra';
import * as path from 'path';
import { QuickPickItem, Uri, window } from "vscode";
import { IActionContext, UserCancelledError } from 'vscode-azureextensionui';
import { ext } from '../../extensionVariables';
import { isTleExpression } from "../../language/expressions/isTleExpression";
import * as Json from "../../language/json/JSON";
@ -24,7 +24,7 @@ export async function queryCreateParameterFile(actionContext: IActionContext, sc
const required = <QuickPickItem>{ label: "Only required parameters", description: "Uses only parameters that have no default value in the template file" };
const templateUri = scope.document.documentUri;
const whichParams = await ext.ui.showQuickPick([all, required], {
const whichParams = await actionContext.ui.showQuickPick([all, required], {
placeHolder: `Include which parameters from ${path.basename(templateUri.fsPath)}?`
});
const onlyRequiredParams = whichParams === required;

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

@ -2,11 +2,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
import { callWithTelemetryAndErrorHandling, DialogResponses, IActionContext, IAzureQuickPickItem, UserCancelledError } from "@microsoft/vscode-azext-utils";
import * as assert from 'assert';
import * as fse from 'fs-extra';
import * as path from 'path';
import { commands, MessageItem, TextDocument, Uri, window, workspace } from 'vscode';
import { callWithTelemetryAndErrorHandling, DialogResponses, IActionContext, IAzureQuickPickItem, UserCancelledError } from 'vscode-azureextensionui';
import { armTemplateLanguageId, configKeys, configPrefix, documentSchemes, globalStateKeys } from '../../../common';
import { ext } from '../../extensionVariables';
import { normalizeFilePath } from '../../util/normalizedPaths';
@ -44,13 +44,13 @@ export async function selectParameterFile(actionContext: IActionContext, mapping
}
if (!editor || !sourceUri || editor.document.uri.fsPath !== sourceUri.fsPath) {
await ext.ui.showWarningMessage(`Please open an Azure Resource Manager template file before trying to associate or create a parameter file.`);
await actionContext.ui.showWarningMessage(`Please open an Azure Resource Manager template file before trying to associate or create a parameter file.`);
return;
}
if (editor.document.languageId !== armTemplateLanguageId) {
actionContext.telemetry.properties.languageId = editor.document.languageId;
await ext.ui.showWarningMessage(`The current file "${sourceUri.fsPath}" does not appear to be an Azure Resource Manager Template. Please open one or make sure the editor Language Mode in the context menu is set to "Azure Resource Manager Template".`);
await actionContext.ui.showWarningMessage(`The current file "${sourceUri.fsPath}" does not appear to be an Azure Resource Manager Template. Please open one or make sure the editor Language Mode in the context menu is set to "Azure Resource Manager Template".`);
return;
}
@ -67,7 +67,7 @@ export async function selectParameterFile(actionContext: IActionContext, mapping
let quickPickList: IQuickPickList = await createParameterFileQuickPickList(mapping, templateUri);
// Show the quick pick
const result: IAzureQuickPickItem<IPossibleParameterFile | undefined> = await ext.ui.showQuickPick(
const result: IAzureQuickPickItem<IPossibleParameterFile | undefined> = await actionContext.ui.showQuickPick(
quickPickList.items,
{
canPickMany: false,
@ -96,7 +96,7 @@ export async function selectParameterFile(actionContext: IActionContext, mapping
const selectedParamsPath: Uri = paramsPaths[0];
if (!await isParameterFile(selectedParamsPath.fsPath)) {
const selectAnywayResult = await ext.ui.showWarningMessage(
const selectAnywayResult = await actionContext.ui.showWarningMessage(
`"${selectedParamsPath.fsPath}" does not appear to be a valid parameter file. Select it anyway?`,
{ modal: true },
DialogResponses.yes,
@ -149,7 +149,7 @@ export async function openParameterFile(mapping: DeploymentFileMapping, template
}
}
export async function openTemplateFile(mapping: DeploymentFileMapping, parameterUri: Uri | undefined, templateUri: Uri | undefined): Promise<void> {
export async function openTemplateFile(actionContext: IActionContext, mapping: DeploymentFileMapping, parameterUri: Uri | undefined, templateUri: Uri | undefined): Promise<void> {
if (parameterUri) {
templateUri = templateUri ?? mapping.getTemplateFile(parameterUri);
if (!templateUri) {
@ -161,7 +161,7 @@ export async function openTemplateFile(mapping: DeploymentFileMapping, parameter
await window.showTextDocument(doc);
} else {
const remove: MessageItem = { title: `Unlink` };
const response: MessageItem = await ext.ui.showWarningMessage(
const response: MessageItem = await actionContext.ui.showWarningMessage(
`Could not find associated template file "${templateUri.fsPath}". Unlink this association?`,
remove,
DialogResponses.cancel

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

@ -4,9 +4,9 @@
// tslint:disable: max-classes-per-file
import { parseError } from "@microsoft/vscode-azext-utils";
import * as path from "path";
import { Uri } from 'vscode';
import { parseError } from 'vscode-azureextensionui';
import { documentSchemes } from "../../../common";
import { ext } from '../../extensionVariables';
import { assert } from "../../fixed_assert";

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

@ -4,10 +4,10 @@
// tslint:disable: max-classes-per-file // Private classes are related to DeploymentTemplate implementation
import { IActionContext } from "@microsoft/vscode-azext-utils";
import * as assert from 'assert';
import * as path from 'path';
import { CodeAction, CodeActionContext, CodeActionKind, Command, DocumentLink, Range, Selection, Uri } from "vscode";
import { IActionContext } from 'vscode-azureextensionui';
import { configKeys, templateKeys } from "../../../common";
import { TemplateScopeKind } from '../../../extension.bundle';
import { ext } from '../../extensionVariables';

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

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IActionContext, IAzureUserInput, UserCancelledError } from "@microsoft/vscode-azext-utils";
import * as vscode from "vscode";
import { IActionContext, IAzureUserInput, UserCancelledError } from "vscode-azureextensionui";
import { isTleExpression } from "../../language/expressions/isTleExpression";
import { ObjectValue } from "../../language/json/JSON";
import { DeploymentTemplateDoc } from "./DeploymentTemplateDoc";

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

@ -4,8 +4,8 @@
// tslint:disable: max-classes-per-file
import { parseError } from "@microsoft/vscode-azext-utils";
import { Range, Uri } from 'vscode';
import { parseError } from 'vscode-azureextensionui';
import { Span } from '../../language/Span';
import { pathExistsNoThrow } from '../../util/pathExistsNoThrow';
import { IGotoParameterValueArgs } from '../../vscodeIntegration/commandArguments';

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

@ -3,8 +3,8 @@
// Licensed under the MIT License. See License.md in the project root for license information.
// ---------------------------------------------------------------------------------------------
import { IActionContext } from "@microsoft/vscode-azext-utils";
import * as vscode from "vscode";
import { IActionContext } from "vscode-azureextensionui";
import { IGotoResourcesArgs } from "../../vscodeIntegration/commandArguments";
/**

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

@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IActionContext, IAzureQuickPickItem, IAzureUserInput } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import * as vscode from "vscode";
// tslint:disable-next-line:no-duplicate-imports
import { commands } from "vscode";
import { IActionContext, IAzureQuickPickItem, IAzureUserInput } from "vscode-azureextensionui";
import { Json, templateKeys } from "../../../extension.bundle";
import { ext } from "../../extensionVariables";
import { ObjectValue } from "../../language/json/JSON";

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

@ -2,10 +2,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
import { callWithTelemetryAndErrorHandling, DialogResponses, IActionContext, parseError, TelemetryProperties } from "@microsoft/vscode-azext-utils";
import * as fse from 'fs-extra';
import * as path from 'path';
import { Diagnostic, TextDocument, Uri, window, workspace } from "vscode";
import { callWithTelemetryAndErrorHandling, DialogResponses, IActionContext, parseError, TelemetryProperties } from "vscode-azureextensionui";
import { armTemplateLanguageId, documentSchemes } from '../../../../common';
import { Errorish } from '../../../Errorish';
import { ext } from "../../../extensionVariables";
@ -260,7 +260,7 @@ export async function openLinkedTemplateFileCommand(linkedTemplateUri: Uri, acti
actionContext.telemetry.properties.exists = String(exists);
if (!exists) {
const fsPath = linkedTemplateUri.fsPath;
const response = await ext.ui.showWarningMessage(
const response = await actionContext.ui.showWarningMessage(
`Could not find file "${fsPath}". Do you want to create it?`,
DialogResponses.yes,
DialogResponses.cancel);
@ -291,7 +291,7 @@ export async function reloadLinkedTemplateFileCommand(linkedTemplateUri: Uri, ac
actionContext.telemetry.properties.exists = String(exists);
if (!exists) {
const fsPath = linkedTemplateUri.fsPath;
const response = await ext.ui.showWarningMessage(
const response = await actionContext.ui.showWarningMessage(
`Could not find file "${fsPath}". Do you want to create it?`,
DialogResponses.yes,
DialogResponses.cancel);

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

@ -2,9 +2,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
import { IActionContext } from "@microsoft/vscode-azext-utils";
import * as path from 'path';
import { languages, Position, Range, TextDocument, workspace } from "vscode";
import { IActionContext } from "vscode-azureextensionui";
import { armTemplateLanguageId, configKeys, configPrefix, documentSchemes } from "../../../common";
import { containsArmSchema, containsParametersSchema } from "./schemas";

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

@ -5,9 +5,9 @@
// tslint:disable:promise-function-async max-line-length // Grandfathered in
// CONSIDER: Refactor this file
import { callWithTelemetryAndErrorHandling, callWithTelemetryAndErrorHandlingSync, createAzExtOutputChannel, IActionContext, ITelemetryContext, parseError, registerCommand, registerUIExtensionVariables, TelemetryProperties } from "@microsoft/vscode-azext-utils";
import * as path from 'path';
import * as vscode from "vscode";
import { AzureUserInput, callWithTelemetryAndErrorHandling, callWithTelemetryAndErrorHandlingSync, createAzExtOutputChannel, IActionContext, ITelemetryContext, parseError, registerCommand, registerUIExtensionVariables, TelemetryProperties } from "vscode-azureextensionui";
import { armTemplateLanguageId, configKeys, configPrefix, documentSchemes, expressionsDiagnosticsCompletionMessage, expressionsDiagnosticsSource, globalStateKeys, outputChannelName } from "../common";
import { delay } from "../test/support/delay";
import { writeToLog } from '../test/support/testLog';
@ -95,7 +95,6 @@ export async function activateInternal(context: vscode.ExtensionContext, perfSta
ext.extensionStartupComplete = false;
ext.context = context;
ext.ui = new AzureUserInput(context.globalState);
let outputChannel = createAzExtOutputChannel(outputChannelName, configPrefix);
if (echoOutputChannelToConsole) {
outputChannel = new ConsoleOutputChannelWrapper(outputChannel);
@ -211,7 +210,7 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
registerCommand("azurerm-vscode-tools.treeview.goto", (_actionContext: IActionContext, range: vscode.Range) => {
jsonOutline.revealRangeInEditor(range);
});
registerCommand("azurerm-vscode-tools.sortTemplate", async (_context: IActionContext, uri?: vscode.Uri, editor?: vscode.TextEditor) => {
registerCommand("azurerm-vscode-tools.sortTemplate", async (actionContext: IActionContext, uri?: vscode.Uri, editor?: vscode.TextEditor) => {
editor = editor || vscode.window.activeTextEditor;
uri = uri || vscode.window.activeTextEditor?.document.uri;
// If "Sort template..." was called from the context menu for ARM template outline
@ -219,7 +218,7 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
uri = vscode.window.activeTextEditor?.document.uri;
}
if (uri && editor) {
const sectionType = await ext.ui.showQuickPick(getQuickPickItems(), { placeHolder: 'What do you want to sort?' });
const sectionType = await actionContext.ui.showQuickPick(getQuickPickItems(), { placeHolder: 'What do you want to sort?' });
await this.sortTemplate(sectionType.value, uri, editor);
}
});
@ -251,9 +250,9 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
await openParameterFile(this._mapping, sourceTemplateUri, undefined);
});
registerCommand(
"azurerm-vscode-tools.openTemplateFile", async (_actionContext: IActionContext, sourceParamUri?: vscode.Uri) => {
"azurerm-vscode-tools.openTemplateFile", async (actionContext: IActionContext, sourceParamUri?: vscode.Uri) => {
sourceParamUri = sourceParamUri ?? vscode.window.activeTextEditor?.document.uri;
await openTemplateFile(this._mapping, sourceParamUri, undefined);
await openTemplateFile(actionContext, this._mapping, sourceParamUri, undefined);
});
registerCommand(
"azurerm-vscode-tools.codeLens.openLinkedTemplateFile", async (actionContext: IActionContext, linkedTemplateUri: vscode.Uri) => {
@ -272,7 +271,7 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
uri = vscode.window.activeTextEditor?.document.uri;
}
if (uri && editor) {
const sectionType = await ext.ui.showQuickPick(getItemTypeQuickPicks(), { placeHolder: 'What do you want to insert?' });
const sectionType = await actionContext.ui.showQuickPick(getItemTypeQuickPicks(), { placeHolder: 'What do you want to insert?' });
await this.insertItem(sectionType.value, actionContext, uri, editor);
}
});
@ -299,7 +298,7 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
registerCommand("azurerm-vscode-tools.codeAction.addMissingRequiredParameters", async (actionContext: IActionContext, source?: vscode.Uri, args?: IAddMissingParametersArgs) => {
await this.addMissingParameters(actionContext, source, args, true);
});
registerCommand("azurerm-vscode-tools.codeAction.extractParameter", async (_context: IActionContext, uri?: vscode.Uri, editor?: vscode.TextEditor) => {
registerCommand("azurerm-vscode-tools.codeAction.extractParameter", async (actionContext: IActionContext, uri?: vscode.Uri, editor?: vscode.TextEditor) => {
editor = editor || vscode.window.activeTextEditor;
uri = uri || vscode.window.activeTextEditor?.document.uri;
if (editor) {
@ -307,10 +306,10 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
if (!deploymentTemplate) {
return;
}
await new ExtractItem(ext.ui).extractParameter(editor, deploymentTemplate, _context);
await new ExtractItem(actionContext.ui).extractParameter(editor, deploymentTemplate, actionContext);
}
});
registerCommand("azurerm-vscode-tools.codeAction.extractVariable", async (_context: IActionContext, uri?: vscode.Uri, editor?: vscode.TextEditor) => {
registerCommand("azurerm-vscode-tools.codeAction.extractVariable", async (actionContext: IActionContext, uri?: vscode.Uri, editor?: vscode.TextEditor) => {
editor = editor || vscode.window.activeTextEditor;
uri = uri || vscode.window.activeTextEditor?.document.uri;
if (editor) {
@ -318,7 +317,7 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
if (!deploymentTemplate) {
return;
}
await new ExtractItem(ext.ui).extractVariable(editor, deploymentTemplate, _context);
await new ExtractItem(actionContext.ui).extractVariable(editor, deploymentTemplate, actionContext);
}
});
@ -492,12 +491,12 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
}
}
private async insertItem(sectionType: TemplateSectionType, context: IActionContext, documentUri?: vscode.Uri, editor?: vscode.TextEditor): Promise<void> {
private async insertItem(sectionType: TemplateSectionType, actionContext: IActionContext, documentUri?: vscode.Uri, editor?: vscode.TextEditor): Promise<void> {
editor = editor || vscode.window.activeTextEditor;
documentUri = documentUri || editor?.document.uri;
if (editor && documentUri && editor.document.uri.fsPath === documentUri.fsPath) {
let deploymentTemplate = this.getOpenedDeploymentTemplate(editor.document);
await new InsertItem(ext.ui).insertItem(deploymentTemplate, sectionType, editor, context);
await new InsertItem(actionContext.ui).insertItem(deploymentTemplate, sectionType, editor, actionContext);
}
}
@ -941,7 +940,7 @@ export class AzureRMToolsExtension implements IProvideOpenedDocuments {
const notNow: vscode.MessageItem = { title: "Not now" };
const neverForThisFile: vscode.MessageItem = { title: "Never for this file" };
const response = await ext.ui.showWarningMessage(
const response = await actionContext.ui.showWarningMessage(
`Warning: You are using a deprecated schema version that is no longer maintained. Would you like us to update "${path.basename(document.uri.path)}" to use the newest schema?`,
{
learnMoreLink: "https://aka.ms/vscode-azurearmtools-updateschema"

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

@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IAzExtOutputChannel } from "@microsoft/vscode-azext-utils";
import * as os from 'os';
import * as path from "path";
import * as vscode from "vscode";
import { IAzExtOutputChannel, IAzureUserInput } from "vscode-azureextensionui";
import { LanguageClient } from 'vscode-languageclient/node';
import { configPrefix, isWebpack } from "../common";
import { DeploymentFileMapping } from "./documents/parameters/DeploymentFileMapping";
@ -29,7 +29,6 @@ class ExtensionVariables {
private _context: InitializeBeforeUse<vscode.ExtensionContext> = new InitializeBeforeUse<vscode.ExtensionContext>("_context");
private _jsonOutlineProvider: InitializeBeforeUse<JsonOutlineProvider> = new InitializeBeforeUse<JsonOutlineProvider>("_jsonOutlineProvider");
private _outputChannel: InitializeBeforeUse<IAzExtOutputChannel> = new InitializeBeforeUse<IAzExtOutputChannel>("_outputChannel");
private _ui: InitializeBeforeUse<IAzureUserInput> = new InitializeBeforeUse<IAzureUserInput>("_ui");
private _languageServerState: LanguageServerState = LanguageServerState.NotStarted;
private _languageServerStateEmitter: vscode.EventEmitter<void> = new vscode.EventEmitter<void>();
@ -54,13 +53,6 @@ class ExtensionVariables {
return this._outputChannel.value;
}
public set ui(ui: IAzureUserInput) {
this._ui.value = ui;
}
public get ui(): IAzureUserInput {
return this._ui.value;
}
public EOL: string = os.EOL;
public pathSeparator: string = path.sep;
public provideOpenedDocuments: IProvideOpenedDocuments | undefined;

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

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { callWithTelemetryAndErrorHandlingSync, IActionContext, parseError } from "@microsoft/vscode-azext-utils";
import * as os from 'os';
import { callWithTelemetryAndErrorHandlingSync, IActionContext, parseError } from 'vscode-azureextensionui';
import { Message } from 'vscode-jsonrpc';
import { CloseAction, ErrorAction, ErrorHandler } from 'vscode-languageclient';
import { languageServerName } from '../../common';

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

@ -3,7 +3,7 @@
// Licensed under the MIT License. See License.md in the project root for license information.
// ---------------------------------------------------------------------------------------------
import { callWithTelemetryAndErrorHandling } from "vscode-azureextensionui";
import { callWithTelemetryAndErrorHandling } from "@microsoft/vscode-azext-utils";
import { ext } from "../extensionVariables";
import { assert } from "../fixed_assert";
import { CaseInsensitiveMap } from "../util/CaseInsensitiveMap";

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

@ -3,7 +3,7 @@
// Licensed under the MIT License. See License.md in the project root for license information.
// ---------------------------------------------------------------------------------------------
import { callWithTelemetryAndErrorHandlingSync } from "vscode-azureextensionui";
import { callWithTelemetryAndErrorHandlingSync } from "@microsoft/vscode-azext-utils";
import { ext } from "../extensionVariables";
import { CaseInsensitiveMap } from "../util/CaseInsensitiveMap";
import { getAvailableResourceTypesAndVersionsNoThrow } from "./getAvailableResourceTypesAndVersionsNoThrow";

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

@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { callWithTelemetryAndErrorHandling, callWithTelemetryAndErrorHandlingSync, IActionContext, ITelemetryContext, parseError } from "@microsoft/vscode-azext-utils";
import * as fse from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
import { CancellationToken, CompletionContext, CompletionItem, CompletionList, Diagnostic, Event, EventEmitter, Position, ProgressLocation, TextDocument, Uri, window, workspace } from 'vscode';
import { callWithTelemetryAndErrorHandling, callWithTelemetryAndErrorHandlingSync, IActionContext, ITelemetryContext, parseError } from 'vscode-azureextensionui';
import { LanguageClient, LanguageClientOptions, RevealOutputChannelOn, ServerOptions } from 'vscode-languageclient/node';
import { armTemplateLanguageId, backendValidationDiagnosticsSource, configKeys, configPrefix, downloadDotnetVersion, isRunningTests, languageFriendlyName, languageServerFolderName, languageServerName, notifications } from '../../common';
import { delay } from '../../test/support/delay';

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

@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { callWithTelemetryAndErrorHandling, IActionContext } from "@microsoft/vscode-azext-utils";
import * as fse from 'fs-extra';
import * as path from 'path';
import * as stripJsonComments from "strip-json-comments";
import { window } from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext } from 'vscode-azureextensionui';
import { assetsPath, extensionName } from '../../common';
import { assert } from '../fixed_assert';
import { Span } from '../language/Span';

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

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { parseError } from "vscode-azureextensionui";
import { parseError } from "@microsoft/vscode-azext-utils";
import { assert } from "../fixed_assert";
import { KnownContexts } from "./KnownContexts";
import { ISnippetDefinitionFromFile } from "./SnippetManager";

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

@ -2,8 +2,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
import { callWithTelemetryAndErrorHandling, IActionContext } from "@microsoft/vscode-azext-utils";
import { commands, MessageItem, window } from 'vscode';
import { callWithTelemetryAndErrorHandling, IActionContext } from "vscode-azureextensionui";
import { globalStateKeys } from '../common';
import { ext } from "./extensionVariables";
import { assert } from './fixed_assert';

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

@ -5,7 +5,7 @@
/**
* Create a deep copy of the provided value.
*/
export function deepClone<T extends {}>(value: T): T {
export function deepClone<T>(value: T): T {
let result: unknown;
if (value === null ||
@ -25,7 +25,7 @@ export function deepClone<T extends {}>(value: T): T {
// tslint:disable-next-line:no-for-in // Grandfathered in
for (let propertyName in value) {
// tslint:disable-next-line: no-unsafe-any no-any
if (value.hasOwnProperty(propertyName)) {
if (Object.prototype.hasOwnProperty.call(value, propertyName)) {
(<{ [key: string]: unknown }>result)[propertyName] = deepClone(value[propertyName]);
}
}

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

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IActionContext, UserCancelledError } from "@microsoft/vscode-azext-utils";
import { CancellationToken } from 'vscode';
import { IActionContext, UserCancelledError } from 'vscode-azureextensionui';
import { CancellationTokenSource } from 'vscode-jsonrpc';
export class Cancellation {

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

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { parseError } from "@microsoft/vscode-azext-utils";
import * as os from 'os';
import { parseError } from 'vscode-azureextensionui';
/**
* "Wraps" an existing throwable item, placing a new message at the beginning of the current message.

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

@ -3,8 +3,8 @@
// Licensed under the MIT License. See License.md in the project root for license information.
// ---------------------------------------------------------------------------------------------
import { IAzExtOutputChannel } from "@microsoft/vscode-azext-utils";
import * as vscode from "vscode";
import { IAzExtOutputChannel } from "vscode-azureextensionui";
/**
* Wraps an output channel to echo everything logged to the console
@ -46,6 +46,11 @@ export class ConsoleOutputChannelWrapper implements IAzExtOutputChannel {
this.outputChannel.show(column, preserveFocus);
}
public replace(value: string): void {
console.log(value);
this.outputChannel.replace(value);
}
public hide(): void {
this.outputChannel.hide();
}

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

@ -3,13 +3,13 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { DialogResponses, IActionContext, UserCancelledError } from "@microsoft/vscode-azext-utils";
import { commands, window } from "vscode";
import { DialogResponses, IActionContext, UserCancelledError } from "vscode-azureextensionui";
import { extensionName, globalStateKeys } from "../../common";
import { ext } from "../extensionVariables";
export async function resetGlobalState(actionContext: IActionContext): Promise<void> {
if (DialogResponses.yes === await ext.ui.showWarningMessage(
if (DialogResponses.yes === await actionContext.ui.showWarningMessage(
`Reset all global state for the ${extensionName} extension (VS Code settings will not be changed)? This will cause such things as whether you wish to answer a survey or whether to ignore certain files to be forgotten.`,
DialogResponses.yes,
DialogResponses.cancel)

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

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IActionContext } from "@microsoft/vscode-azext-utils";
import * as vscode from 'vscode';
import { IActionContext } from 'vscode-azureextensionui';
import { IJsonDocument } from '../documents/templates/IJsonDocument';
import { assert } from '../fixed_assert';
import { assertNever } from '../util/assertNever';

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

@ -5,11 +5,11 @@
// tslint:disable:no-unused-expression max-func-body-length promise-function-async max-line-length insecure-random
// tslint:disable:object-literal-key-quotes no-function-expression no-non-null-assertion align no-http-string
import { parseError } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import { randomBytes } from "crypto";
import { Context, Suite } from "mocha";
import { Uri } from "vscode";
import { parseError } from "vscode-azureextensionui";
import { DefinitionKind, DeploymentTemplateDoc, getVSCodeRangeFromSpan, Histogram, INamedDefinition, IncorrectArgumentsCountIssue, IParameterDefinition, Issue, IssueKind, IVariableDefinition, Json, LineColPos, ReferenceInVariableDefinitionsVisitor, ReferenceList, Span, TemplateScope, UnrecognizedUserFunctionIssue, UnrecognizedUserNamespaceIssue } from "../extension.bundle";
import { diagnosticSources, IDeploymentTemplate, testDiagnostics } from "./support/diagnostics";
import { getEmptyCodeActionContext } from "./support/getEmptyCodeActionContext";

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

@ -5,12 +5,12 @@
// tslint:disable:max-func-body-length align max-line-length
// tslint:disable:no-non-null-assertion no-invalid-template-strings
import { parseError } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import * as fse from 'fs-extra';
import { Context, Done } from "mocha";
import * as path from "path";
import * as vscode from "vscode";
import { parseError } from "vscode-azureextensionui";
import { ext, IElementInfo, JsonOutlineProvider, shortenTreeLabel } from "../extension.bundle";
import { getTempFilePath } from "./support/getTempFilePath";

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

@ -8,13 +8,13 @@
// Turn on to overwrite results files rather than creating new ".txt.actual" files when there are differences.
const OVERWRITE = false;
import { parseError } from "@microsoft/vscode-azext-utils";
import * as assert from 'assert';
import * as fs from 'fs';
import { Context, Suite } from 'mocha';
import * as os from 'os';
import * as path from 'path';
import { commands, Uri } from 'vscode';
import { parseError } from 'vscode-azureextensionui';
import { getTempFilePath } from '../support/getTempFilePath';
import { normalizeString } from '../support/normalizeString';
import { writeToLog } from '../support/testLog';

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

@ -8,10 +8,10 @@
// WARNING: At the breakpoint, the extension will be in an inactivate state (i.e., if you make changes in the editor, diagnostics,
// formatting, etc. will not be updated until you F5 again)
import { TestUserInput } from "@microsoft/vscode-azext-dev";
import * as assert from 'assert';
import * as fse from 'fs-extra';
import * as vscode from "vscode";
import { TestUserInput } from 'vscode-azureextensiondev';
import { DeploymentTemplateDoc, ExtractItem } from '../../extension.bundle';
import { assertEx } from '../support/assertEx';
import { IPartialDeploymentTemplate } from '../support/diagnostics';

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

@ -5,7 +5,7 @@
// ---------------------------------------------------------------------------------------------
// tslint:disable-next-line: no-suspicious-comment
// TODO: Gives this on build machine only: Error: "registerUIExtensionVariables" must be called before using the vscode-azureextensionui package.
// TODO: Gives this on build machine only: Error: "registerUIExtensionVariables" must be called before using the @microsoft/vscode-azext-utils package.
/*
import * as assert from "assert";
import { getAvailableResourceTypesAndVersions } from "../../extension.bundle";

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

@ -7,12 +7,12 @@
// WARNING: At the breakpoint, the extension will be in an inactivate state (i.e., if you make changes in the editor, diagnostics,
// formatting, etc. will not be updated until you F5 again)
import { IAzureUserInput, PromptResult } from "@microsoft/vscode-azext-utils";
import * as assert from 'assert';
import * as fse from 'fs-extra';
import * as vscode from "vscode";
// tslint:disable-next-line:no-duplicate-imports
import { window, workspace } from "vscode";
import { IAzureUserInput, PromptResult } from 'vscode-azureextensionui';
import { DeploymentTemplateDoc, InsertItem, TemplateSectionType } from '../../extension.bundle';
import { getActionContext } from '../support/getActionContext';
import { getTempFilePath } from "../support/getTempFilePath";
@ -492,7 +492,7 @@ suite("InsertItem", async (): Promise<void> => {
});
});
// CONSIDER: Switch to using TestUserInput from vscode-azureextensiondev
// CONSIDER: Switch to using TestUserInput from @microsoft/vscode-azext-dev
class MockUserInput implements IAzureUserInput {
private showInputBoxTexts: string[] = [];
private _onDidFinishPromptEmitter: vscode.EventEmitter<PromptResult> = new vscode.EventEmitter<PromptResult>();
@ -505,7 +505,7 @@ class MockUserInput implements IAzureUserInput {
return this._onDidFinishPromptEmitter.event;
}
public async showQuickPick<T extends vscode.QuickPickItem>(items: T[] | Thenable<T[]>, options: import("vscode-azureextensionui").IAzureQuickPickOptions): Promise<T> {
public async showQuickPick<T extends vscode.QuickPickItem>(items: T[] | Thenable<T[]>, options: import("@microsoft/vscode-azext-utils").IAzureQuickPickOptions): Promise<T> {
let result = await items;
let label = this.showInputBoxTexts.shift()!;
let item = result.find(x => x.label === label)!;
@ -516,11 +516,15 @@ class MockUserInput implements IAzureUserInput {
return this.showInputBoxTexts.shift()!;
}
public async showWarningMessage<T extends vscode.MessageItem>(message: string, options: import("vscode-azureextensionui").IAzureMessageOptions, ...items: T[]): Promise<T> {
public async showWarningMessage<T extends vscode.MessageItem>(message: string, options: import("@microsoft/vscode-azext-utils").IAzureMessageOptions, ...items: T[]): Promise<T> {
return items[0];
}
public async showOpenDialog(options: vscode.OpenDialogOptions): Promise<vscode.Uri[]> {
return [vscode.Uri.file("c:\\some\\path")];
}
public async showWorkspaceFolderPick(options: vscode.WorkspaceFolderPickOptions): Promise<vscode.WorkspaceFolder> {
throw new Error('showWorkspaceFolderPick not implemented.');
}
}

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

@ -4,9 +4,9 @@
// tslint:disable:object-literal-key-quotes no-http-string max-func-body-length
import { parseError } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import { Uri } from "vscode";
import { parseError } from "vscode-azureextensionui";
import { assertNever, LinkedFileLoadState, notifications, notifyTemplateGraphAvailable } from "../../extension.bundle";
import { ExpectedDiagnostics, IExpectedDiagnostic, simplifyBadTypeResourceMessage, testDiagnostics, testDiagnosticsFromUri } from "../support/diagnostics";
import { ensureLanguageServerAvailable } from "../support/ensureLanguageServerAvailable";

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

@ -5,12 +5,12 @@
// tslint:disable:no-console no-function-expression no-implicit-dependencies
import { parseError } from "@microsoft/vscode-azext-utils";
import * as fse from 'fs-extra';
import * as mocha from 'mocha';
import * as path from 'path';
import * as rimraf from 'rimraf';
import * as vscode from 'vscode';
import { parseError } from 'vscode-azureextensionui';
import { armTemplateLanguageId, configKeys, configPrefix, ext, stopArmLanguageServer } from "../extension.bundle";
import { displayCacheStatus } from './support/cache';
import { delay } from "./support/delay";

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

@ -3,8 +3,8 @@
// Licensed under the MIT License. See License.md in the project root for license information.
// ---------------------------------------------------------------------------------------------
import { parseError } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import { parseError } from "vscode-azureextensionui";
import { stringify } from "./stringify";
//tslint:disable prefer-template

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

@ -5,12 +5,12 @@
// tslint:disable: no-implicit-dependencies
import { parseError } from "@microsoft/vscode-azext-utils";
import * as fse from 'fs-extra';
import * as os from 'os';
import * as path from 'path';
import * as process from 'process';
import * as rimraf from 'rimraf';
import { parseError } from 'vscode-azureextensionui';
import { isWin32 } from '../testConstants';
import { writeToError, writeToLog } from './testLog';

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

@ -13,11 +13,11 @@ const DEBUG_BREAK_AFTER_DIAGNOSTICS_COMPLETE = false;
// tslint:disable:object-literal-key-quotes no-http-string non-literal-fs-path
// tslint:disable:no-non-null-assertion
import { parseError } from "@microsoft/vscode-azext-utils";
import * as assert from "assert";
import * as fse from "fs-extra";
import * as path from 'path';
import { Diagnostic, DiagnosticSeverity, Disposable, languages, Position, Range, TextDocument, Uri } from "vscode";
import { parseError } from "vscode-azureextensionui";
import { backendValidationDiagnosticsSource, diagnosticsCompletePrefix, expressionsDiagnosticsSource, ExpressionType, ext, LanguageServerState, languageServerStateSource, readUtf8FileWithBom } from "../../extension.bundle";
import { bail } from "../global.test";
import { DEFAULT_TESTCASE_TIMEOUT_MS, DISABLE_LANGUAGE_SERVER } from "../testConstants";
@ -315,7 +315,7 @@ export async function getDiagnosticsForDocument(
const documentUri = document instanceof Uri ? document : document.uri;
let dispose: Disposable | undefined;
let timer: NodeJS.Timer | undefined;
let timer: NodeJS.Timeout | undefined;
// Default to all sources
let filterSources: DiagnosticSource[] = Array.from(Object.values(diagnosticSources));

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

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IActionContext, IAzureUserInput } from "vscode-azureextensionui";
import { IActionContext, IAzureUserInput } from "@microsoft/vscode-azext-utils";
export function getActionContext(): IActionContext {
return {

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

@ -2,10 +2,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
import { parseError } from "@microsoft/vscode-azext-utils";
import * as assert from 'assert';
import * as fse from 'fs-extra';
import { Uri } from 'vscode';
import { parseError } from 'vscode-azureextensionui';
import { DeploymentParametersDoc, DeploymentTemplateDoc, Issue, IssueSeverity } from "../../extension.bundle";
import { IDeploymentParametersFile, IPartialDeploymentTemplate } from './diagnostics';
import { resolveInTestFolder } from './resolveInTestFolder';

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

@ -9,7 +9,7 @@
"gulp",
"dev",
"mocha",
"vscode-azureextensiondev",
"@microsoft/vscode-azext-dev",
"@vscode/test-electron"
]
],

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

@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { parseError } from "@microsoft/vscode-azext-utils";
import * as assert from 'assert';
import { parseError } from 'vscode-azureextensionui';
import { ext, wrapError } from '../extension.bundle';
suite("wrapError", () => {

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

@ -32,7 +32,7 @@
[
"vscode",
"gulp",
"vscode-azureextensiondev"
"@microsoft/vscode-azext-dev"
]
],
"no-increment-decrement": false,

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

@ -10,12 +10,13 @@
'use strict';
const process = require('process');
const dev = require("vscode-azureextensiondev");
const dev = require("@microsoft/vscode-azext-dev");
let DEBUG_WEBPACK = !/^(false|0)?$/i.test(process.env.DEBUG_WEBPACK || '');
let config = dev.getDefaultWebpackConfig({
projectRoot: __dirname,
target: 'node',
verbosity: DEBUG_WEBPACK ? 'debug' : 'normal'
});