Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
add uri handler for getting started notebook (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo authored Feb 8, 2022
1 parent 8cb5818 commit 916beb1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-dotnet-pack",
"version": "1.0.7",
"version": "1.0.8",
"preview": true,
"publisher": "ms-dotnettools",
"author": "Microsoft Corporation",
Expand Down Expand Up @@ -48,6 +48,7 @@
],
"main": "./out/extension",
"activationEvents": [
"onUri",
"onDebugInitialConfigurations",
"onDebugResolve:blazorwasm",
"onDebugResolve:coreclr",
Expand Down
18 changes: 18 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | undefined>;
Expand Down Expand Up @@ -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);
Expand All @@ -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");
Expand All @@ -72,6 +89,7 @@ async function showGettingStartedView(context: vscode.ExtensionContext, _isForce
}

await vscode.commands.executeCommand("dotnet.gettingStarted");
gettingStartedShownByActivation = true;
context.globalState.update(isDotnetGettingStartedPresented, true);
}

Expand Down

0 comments on commit 916beb1

Please sign in to comment.