Prepare 1.1.2 preview (#112)
* Use 0.4.7 dtdl lsp. * Remove legacy survey * Update/audit package-lock.json
This commit is contained in:
Родитель
a9be9481b5
Коммит
8ef765b897
|
@ -2360,9 +2360,9 @@
|
|||
}
|
||||
},
|
||||
"dtdl-language-server": {
|
||||
"version": "0.4.6",
|
||||
"resolved": "https://registry.npmjs.org/dtdl-language-server/-/dtdl-language-server-0.4.6.tgz",
|
||||
"integrity": "sha512-PZnca1xDyiSsfSmgr+s25UhhlJKWbx912G5GADgmiTFud8FuNVnahJu3en3BXjWK4jA59TiAImUFTjTxszdLug==",
|
||||
"version": "0.4.7",
|
||||
"resolved": "https://registry.npmjs.org/dtdl-language-server/-/dtdl-language-server-0.4.7.tgz",
|
||||
"integrity": "sha512-gWpvnL9OhAkjhHvb0xMM/y+dMkVE8jpR14OxeoBDXZLJPcNloV195JKpWz0NsDa94f5i5E5/xU1K4EuWuCR4/Q==",
|
||||
"requires": {
|
||||
"commander": "^5.0.0",
|
||||
"jsonc-parser": "^2.2.1",
|
||||
|
@ -4924,9 +4924,9 @@
|
|||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"minipass": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "vscode-dtdl",
|
||||
"displayName": "DTDL",
|
||||
"description": "This extension provides syntax highlighting to read and edit JSON documents using the Digital Twins Definition Language",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"publisher": "vsciot-vscode",
|
||||
"aiKey": "[AIKEY PLACEHOLDER]",
|
||||
"icon": "logo.png",
|
||||
|
@ -94,7 +94,7 @@
|
|||
"webpack-cli": "^4.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"dtdl-language-server": "0.4.6",
|
||||
"dtdl-language-server": "0.4.7",
|
||||
"fs-extra": "^7.0.1",
|
||||
"vscode-extension-telemetry": "^0.1.6",
|
||||
"vscode-languageclient": "^6.1.3"
|
||||
|
|
|
@ -23,6 +23,4 @@ export class Constants {
|
|||
|
||||
public static readonly EXTENSION_ACTIVATED_MSG = "extensionActivated";
|
||||
public static readonly NOT_EMPTY_MSG = "could not be empty";
|
||||
|
||||
public static readonly NSAT_SURVEY_URL = "https://aka.ms/vscode-iot-workbench-survey";
|
||||
}
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import { commands, ExtensionContext, Memento, Uri, window } from "vscode";
|
||||
import { Constants } from "./constants";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
|
||||
const PROBABILITY = 1;
|
||||
const SESSION_COUNT_THRESHOLD = 2;
|
||||
const SESSION_COUNT_KEY = "nsat/sessionCount";
|
||||
const LAST_SESSION_DATE_KEY = "nsat/lastSessionDate";
|
||||
const TAKE_SURVEY_DATE_KEY = "nsat/takeSurveyDate";
|
||||
const DONT_SHOW_DATE_KEY = "nsat/dontShowDate";
|
||||
const SKIP_VERSION_KEY = "nsat/skipVersion";
|
||||
const IS_CANDIDATE_KEY = "nsat/isCandidate";
|
||||
|
||||
/**
|
||||
* User survey client
|
||||
*/
|
||||
export class NSAT {
|
||||
constructor(private readonly surveyUrl: string, private readonly telemetryClient: TelemetryClient) {}
|
||||
|
||||
/**
|
||||
* ask user to take survey
|
||||
* @param context extension context
|
||||
*/
|
||||
public async takeSurvey(context: ExtensionContext): Promise<void> {
|
||||
const globalState: Memento = context.globalState;
|
||||
if (!globalState) {
|
||||
return;
|
||||
}
|
||||
const skipVersion: string = globalState.get(SKIP_VERSION_KEY, Constants.EMPTY_STRING);
|
||||
if (skipVersion) {
|
||||
return;
|
||||
}
|
||||
const date: string = new Date().toDateString();
|
||||
const lastSessionDate: string = globalState.get(LAST_SESSION_DATE_KEY, new Date(0).toDateString());
|
||||
if (date === lastSessionDate) {
|
||||
return;
|
||||
}
|
||||
const sessionCount: number = globalState.get(SESSION_COUNT_KEY, 0) + 1;
|
||||
await globalState.update(LAST_SESSION_DATE_KEY, date);
|
||||
await globalState.update(SESSION_COUNT_KEY, sessionCount);
|
||||
if (sessionCount < SESSION_COUNT_THRESHOLD) {
|
||||
return;
|
||||
}
|
||||
const isCandidate: boolean = globalState.get(IS_CANDIDATE_KEY, false) || Math.random() < PROBABILITY;
|
||||
await globalState.update(IS_CANDIDATE_KEY, isCandidate);
|
||||
const extensionVersion: string = this.telemetryClient.extensionVersion;
|
||||
if (!isCandidate) {
|
||||
await globalState.update(SKIP_VERSION_KEY, extensionVersion);
|
||||
return;
|
||||
}
|
||||
const take = {
|
||||
title: "Take Survey",
|
||||
run: async (): Promise<void> => {
|
||||
this.telemetryClient.sendEvent("nsat.survey/takeShortSurvey");
|
||||
commands.executeCommand(
|
||||
"vscode.open",
|
||||
Uri.parse(
|
||||
`${this.surveyUrl}?o=${encodeURIComponent(process.platform)}&v=${encodeURIComponent(extensionVersion)}`
|
||||
)
|
||||
);
|
||||
await globalState.update(IS_CANDIDATE_KEY, false);
|
||||
await globalState.update(SKIP_VERSION_KEY, extensionVersion);
|
||||
await globalState.update(TAKE_SURVEY_DATE_KEY, date);
|
||||
}
|
||||
};
|
||||
const remind = {
|
||||
title: "Remind Me Later",
|
||||
run: async (): Promise<void> => {
|
||||
this.telemetryClient.sendEvent("nsat.survey/remindMeLater");
|
||||
await globalState.update(SESSION_COUNT_KEY, 0);
|
||||
}
|
||||
};
|
||||
const never = {
|
||||
title: "Don't Show Again",
|
||||
run: async (): Promise<void> => {
|
||||
this.telemetryClient.sendEvent("nsat.survey/dontShowAgain");
|
||||
await globalState.update(IS_CANDIDATE_KEY, false);
|
||||
await globalState.update(SKIP_VERSION_KEY, extensionVersion);
|
||||
await globalState.update(DONT_SHOW_DATE_KEY, date);
|
||||
}
|
||||
};
|
||||
this.telemetryClient.sendEvent("nsat.survey/userAsked");
|
||||
const button = await window.showInformationMessage(
|
||||
"Do you mind taking a quick feedback survey about DTDL Extension for VS Code?",
|
||||
take,
|
||||
remind,
|
||||
never
|
||||
);
|
||||
await (button || remind).run();
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import * as vscode from "vscode";
|
|||
import { ColorizedChannel } from "./common/colorizedChannel";
|
||||
import { Constants } from "./common/constants";
|
||||
import { EventType } from "./common/eventType";
|
||||
import { NSAT } from "./common/nsat";
|
||||
import { ProcessError } from "./common/processError";
|
||||
import { TelemetryClient } from "./common/telemetryClient";
|
||||
import { TelemetryContext } from "./common/telemetryContext";
|
||||
|
@ -20,8 +19,6 @@ function initCommand(
|
|||
context: vscode.ExtensionContext,
|
||||
telemetryClient: TelemetryClient,
|
||||
outputChannel: ColorizedChannel,
|
||||
nsat: NSAT,
|
||||
enableSurvey: boolean,
|
||||
event: EventType,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
callback: (...args: any[]) => Promise<any>
|
||||
|
@ -50,9 +47,6 @@ function initCommand(
|
|||
telemetryContext.end();
|
||||
telemetryClient.sendEvent(event, telemetryContext);
|
||||
outputChannel.show();
|
||||
if (enableSurvey) {
|
||||
nsat.takeSurvey(context);
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
@ -61,7 +55,6 @@ function initCommand(
|
|||
export function activate(context: vscode.ExtensionContext): void {
|
||||
const outputChannel = new ColorizedChannel(Constants.CHANNEL_NAME);
|
||||
const telemetryClient = new TelemetryClient(context);
|
||||
const nsat = new NSAT(Constants.NSAT_SURVEY_URL, telemetryClient);
|
||||
const deviceModelManager = new DeviceModelManager(context, outputChannel);
|
||||
|
||||
telemetryClient.sendEvent(Constants.EXTENSION_ACTIVATED_MSG);
|
||||
|
@ -107,8 +100,6 @@ export function activate(context: vscode.ExtensionContext): void {
|
|||
context,
|
||||
telemetryClient,
|
||||
outputChannel,
|
||||
nsat,
|
||||
true,
|
||||
EventType.CreateInterface,
|
||||
async (): Promise<void> => {
|
||||
return deviceModelManager.createModel(ModelType.Interface);
|
||||
|
|
Загрузка…
Ссылка в новой задаче