From 916beb1c5b8fa0452a699a4fb9ab2882f71a083c Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Tue, 8 Feb 2022 15:08:21 -0700 Subject: [PATCH] add uri handler for getting started notebook (#42) --- package.json | 3 ++- src/extension.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8bddbbe..634a1d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vscode-dotnet-pack", - "version": "1.0.7", + "version": "1.0.8", "preview": true, "publisher": "ms-dotnettools", "author": "Microsoft Corporation", @@ -48,6 +48,7 @@ ], "main": "./out/extension", "activationEvents": [ + "onUri", "onDebugInitialConfigurations", "onDebugResolve:blazorwasm", "onDebugResolve:coreclr", diff --git a/src/extension.ts b/src/extension.ts index f963e4d..b45fce8 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -13,6 +13,7 @@ import { scheduleAction } from "./utils/scheduler"; const isDotnetGettingStartedPresented = 'isDotnetGettingStartedPresented'; const dotnetSdkVersion = '6.0'; +let gettingStartedShownByActivation = false; interface DotnetPackExtensionExports { getDotnetPath(version?: string): Promise; @@ -42,6 +43,7 @@ async function getDotnetPath(version?: string) { } async function initializeExtension(_operationId: string, context: vscode.ExtensionContext) { + await initUrlHandler(context); initUtils(context); initCommands(context); initExp(context); @@ -55,6 +57,21 @@ async function initializeExtension(_operationId: string, context: vscode.Extensi } } +async function initUrlHandler(context: vscode.ExtensionContext) { + context.subscriptions.push( + vscode.window.registerUriHandler({ + handleUri: async (uri: vscode.Uri) => { + switch (uri.path) { + case '/gettingStarted': + if (!gettingStartedShownByActivation) { + await vscode.commands.executeCommand("dotnet.gettingStarted"); + } + break; + } + } + })); +} + async function presentFirstView(context: vscode.ExtensionContext) { const config = vscode.workspace.getConfiguration("dotnet.help"); const firstView = config.get("firstView"); @@ -72,6 +89,7 @@ async function showGettingStartedView(context: vscode.ExtensionContext, _isForce } await vscode.commands.executeCommand("dotnet.gettingStarted"); + gettingStartedShownByActivation = true; context.globalState.update(isDotnetGettingStartedPresented, true); }