@@ -104,11 +104,9 @@ export async function requestWorkspaceInformation(server: OmniSharpServer) {
104
104
blazorWebAssemblyProjectFound = blazorWebAssemblyProjectFound || isProjectBlazorWebAssemblyProject ;
105
105
}
106
106
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
+ // No need to await this call, we don't depend on the prompt being shown.
109
+ showBlazorDebuggingExtensionPrompt ( server ) ;
112
110
}
113
111
}
114
112
@@ -243,35 +241,6 @@ async function isBlazorWebAssemblyProject(project: MSBuildProject): Promise<bool
243
241
return false ;
244
242
}
245
243
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
-
275
244
function isWebProject ( project : MSBuildProject ) : boolean {
276
245
let projectFileText = fs . readFileSync ( project . Path , 'utf8' ) ;
277
246
@@ -280,38 +249,16 @@ function isWebProject(project: MSBuildProject): boolean {
280
249
return projectFileText . toLowerCase ( ) . indexOf ( 'sdk="microsoft.net.sdk.web"' ) >= 0 ;
281
250
}
282
251
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
-
303
- function showBlazorDebuggingExtensionPrompt ( server : OmniSharpServer ) {
252
+ async function showBlazorDebuggingExtensionPrompt ( server : OmniSharpServer ) {
304
253
const promptShownKey = 'blazor_debugging_extension_prompt_shown' ;
305
254
if ( ! server . sessionProperties [ promptShownKey ] ) {
306
255
server . sessionProperties [ promptShownKey ] = true ;
307
256
308
257
const msg = 'The Blazor WASM Debugging Extension is required to debug Blazor WASM apps in VS Code.' ;
309
- vscode . window . showInformationMessage ( msg , 'Install Extension' , 'Close' )
310
- . then ( async result => {
311
- if ( result === 'Install Extension' ) {
312
- const uriToOpen = vscode . Uri . parse ( 'vscode:extension/ms-dotnettools.blazorwasm-companion' ) ;
313
- await vscode . commands . executeCommand ( 'vscode.open' , uriToOpen ) ;
314
- }
315
- } ) ;
258
+ const result = await vscode . window . showInformationMessage ( msg , 'Install Extension' , 'Close' ) ;
259
+ if ( result === 'Install Extension' ) {
260
+ const uriToOpen = vscode . Uri . parse ( 'vscode:extension/ms-dotnettools.blazorwasm-companion' ) ;
261
+ await vscode . commands . executeCommand ( 'vscode.open' , uriToOpen ) ;
262
+ }
316
263
}
317
264
}
0 commit comments