Skip to content

Commit a91b4cc

Browse files
committed
Simplify Blazor debug prerequisites check
The necessary JavaScript debugger configurations are now the default, and cannot be disabled.
1 parent 83618ae commit a91b4cc

File tree

2 files changed

+3
-60
lines changed

2 files changed

+3
-60
lines changed

package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,11 +1055,6 @@
10551055
"scope": "window",
10561056
"default": true,
10571057
"description": "Enable/disable default Razor formatter."
1058-
},
1059-
"razor.disableBlazorDebugPrompt": {
1060-
"type": "boolean",
1061-
"default": false,
1062-
"description": "Disable Blazor WebAssembly's debug requirements notification."
10631058
}
10641059
}
10651060
},
@@ -4010,4 +4005,4 @@
40104005
}
40114006
]
40124007
}
4013-
}
4008+
}

src/omnisharp/utils.ts

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,8 @@ export async function requestWorkspaceInformation(server: OmniSharpServer) {
104104
blazorWebAssemblyProjectFound = blazorWebAssemblyProjectFound || isProjectBlazorWebAssemblyProject;
105105
}
106106

107-
if (blazorWebAssemblyProjectFound && !hasBlazorWebAssemblyDebugPrerequisites(server)) {
108-
const configuration = vscode.workspace.getConfiguration('razor');
109-
// There's a Blazor Web Assembly project but VSCode isn't configured to debug the WASM code, show a notification
110-
// to help the user configure their VSCode appropriately.
111-
showBlazorConfigurationRequiredPrompt(server, configuration);
107+
if (blazorWebAssemblyProjectFound && !vscode.extensions.getExtension('ms-dotnettools.blazorwasm-companion')) {
108+
showBlazorDebuggingExtensionPrompt(server);
112109
}
113110
}
114111

@@ -243,35 +240,6 @@ async function isBlazorWebAssemblyProject(project: MSBuildProject): Promise<bool
243240
return false;
244241
}
245242

246-
function hasBlazorWebAssemblyDebugPrerequisites(server: OmniSharpServer) {
247-
const companionExtension = vscode.extensions.getExtension('ms-dotnettools.blazorwasm-companion');
248-
if (!companionExtension) {
249-
showBlazorDebuggingExtensionPrompt(server);
250-
return false;
251-
}
252-
253-
const debugJavaScriptConfigSection = vscode.workspace.getConfiguration('debug.javascript');
254-
const usePreviewValue = debugJavaScriptConfigSection.get('usePreview');
255-
if (usePreviewValue) {
256-
// If usePreview is truthy it takes priority over the useV3 variants.
257-
return true;
258-
}
259-
260-
const debugNodeConfigSection = vscode.workspace.getConfiguration('debug.node');
261-
const useV3NodeValue = debugNodeConfigSection.get('useV3');
262-
if (!useV3NodeValue) {
263-
return false;
264-
}
265-
266-
const debugChromeConfigSection = vscode.workspace.getConfiguration('debug.chrome');
267-
const useV3ChromeValue = debugChromeConfigSection.get('useV3');
268-
if (!useV3ChromeValue) {
269-
return false;
270-
}
271-
272-
return true;
273-
}
274-
275243
function isWebProject(project: MSBuildProject): boolean {
276244
let projectFileText = fs.readFileSync(project.Path, 'utf8');
277245

@@ -280,26 +248,6 @@ function isWebProject(project: MSBuildProject): boolean {
280248
return projectFileText.toLowerCase().indexOf('sdk="microsoft.net.sdk.web"') >= 0;
281249
}
282250

283-
function showBlazorConfigurationRequiredPrompt(server: OmniSharpServer, configuration: vscode.WorkspaceConfiguration) {
284-
const disableBlazorDebugPrompt = configuration.get('disableBlazorDebugPrompt');
285-
286-
const promptShownKey = 'blazor_configuration_required_prompt_shown';
287-
if (!disableBlazorDebugPrompt && !server.sessionProperties[promptShownKey]) {
288-
server.sessionProperties[promptShownKey] = true;
289-
290-
vscode.window.showInformationMessage('Additional setup is required to debug Blazor WebAssembly applications.', 'Don\'t Ask Again', 'Learn more', 'Close')
291-
.then(async result => {
292-
if (result === 'Learn more') {
293-
const uriToOpen = vscode.Uri.parse('https://aka.ms/blazordebugging#vscode');
294-
await vscode.commands.executeCommand('vscode.open', uriToOpen);
295-
}
296-
if (result === 'Don\'t Ask Again') {
297-
await configuration.update('disableBlazorDebugPrompt', true);
298-
}
299-
});
300-
}
301-
}
302-
303251
function showBlazorDebuggingExtensionPrompt(server: OmniSharpServer) {
304252
const promptShownKey = 'blazor_debugging_extension_prompt_shown';
305253
if (!server.sessionProperties[promptShownKey]) {

0 commit comments

Comments
 (0)