Skip to content

Commit

Permalink
WIP: update to new @microsoft/vscode-azext-utils (#1786)
Browse files Browse the repository at this point in the history
* switch to @microsoft/vscode-azext-utils

* force rebuild

* Fix aiKey
  • Loading branch information
StephenWeatherford authored Nov 8, 2024
1 parent 90e9c73 commit 403a527
Show file tree
Hide file tree
Showing 48 changed files with 6,431 additions and 20,565 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';

Expand Down Expand Up @@ -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, [
Expand Down
26,798 changes: 6,330 additions & 20,468 deletions package-lock.json

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand All @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion src/TimedMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/acquisition/acquireSharedDotnetInstallation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions src/documents/parameters/parameterFileGeneration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions src/documents/parameters/parameterFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
}

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/documents/templates/ChildTemplateCodeLens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/documents/templates/DeploymentTemplateDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/documents/templates/ExtractItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/documents/templates/deploymentTemplateCodeLenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/documents/templates/gotoResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/documents/templates/insertItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 3 additions & 3 deletions src/documents/templates/linkedTemplates/linkedTemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/documents/templates/supported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Loading

0 comments on commit 403a527

Please sign in to comment.