Skip to content

Commit

Permalink
Clean up Blazor WebAssembly notifications (#4018)
Browse files Browse the repository at this point in the history
  • Loading branch information
captainsafia authored Aug 26, 2020
1 parent 3be36af commit c14e928
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,11 @@
"scope": "window",
"default": true,
"description": "Enable/disable default Razor formatter."
},
"razor.disableBlazorDebugPrompt": {
"type": "boolean",
"default": false,
"description": "Disable Blazor WebAssembly's debug requirements notification."
}
}
},
Expand Down Expand Up @@ -3491,4 +3496,4 @@
]
}
}
}
}
15 changes: 8 additions & 7 deletions src/omnisharp/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,21 @@ export async function requestWorkspaceInformation(server: OmniSharpServer) {
blazorWebAssemblyProjectFound = blazorWebAssemblyProjectFound || isProjectBlazorWebAssemblyProject;
}

if (!blazorDetectionEnabled && blazorWebAssemblyProjectFound) {
const configuration = vscode.workspace.getConfiguration('razor');
const disableBlazorDebugPrompt = configuration.get('disableBlazorDebugPrompt');

if (!blazorDetectionEnabled && blazorWebAssemblyProjectFound && !disableBlazorDebugPrompt) {
// There's a Blazor Web Assembly project but VSCode isn't configured to debug the WASM code, show a notification
// to help the user configure their VSCode appropriately.
vscode.window.showInformationMessage('Additional setup is required to debug Blazor WebAssembly applications.', 'Learn more', 'Close')
vscode.window.showInformationMessage('Additional setup is required to debug Blazor WebAssembly applications.', 'Don\'t Ask Again', 'Learn more', 'Close')
.then(async result => {
if (result === 'Learn more') {
const uriToOpen = vscode.Uri.parse('https://aka.ms/blazordebugging#vscode');
await vscode.commands.executeCommand('vscode.open', uriToOpen);
}
if (result === 'Don\'t Ask Again') {
await configuration.update('disableBlazorDebugPrompt', true);
}
});
}
}
Expand Down Expand Up @@ -234,11 +240,6 @@ async function isBlazorWebAssemblyProject(project: MSBuildProject): Promise<bool
}

function hasBlazorWebAssemblyDebugPrerequisites() {
const jsDebugExtension = vscode.extensions.getExtension('ms-vscode.js-debug-nightly');
if (!jsDebugExtension) {
return false;
}

const debugJavaScriptConfigSection = vscode.workspace.getConfiguration('debug.javascript');
const usePreviewValue = debugJavaScriptConfigSection.get('usePreview');
if (usePreviewValue) {
Expand Down

0 comments on commit c14e928

Please sign in to comment.