Skip to content

Commit 5366059

Browse files
authored
Merge pull request #4964 from 50Wliu/remove-blazor-debug-preview-checks
Remove obsolete settings checks for Blazor debugging
2 parents 83618ae + 5c3236c commit 5366059

File tree

2 files changed

+10
-68
lines changed

2 files changed

+10
-68
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: 9 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,9 @@ 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+
// No need to await this call, we don't depend on the prompt being shown.
109+
showBlazorDebuggingExtensionPrompt(server);
112110
}
113111
}
114112

@@ -243,35 +241,6 @@ async function isBlazorWebAssemblyProject(project: MSBuildProject): Promise<bool
243241
return false;
244242
}
245243

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-
275244
function isWebProject(project: MSBuildProject): boolean {
276245
let projectFileText = fs.readFileSync(project.Path, 'utf8');
277246

@@ -280,38 +249,16 @@ function isWebProject(project: MSBuildProject): boolean {
280249
return projectFileText.toLowerCase().indexOf('sdk="microsoft.net.sdk.web"') >= 0;
281250
}
282251

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) {
304253
const promptShownKey = 'blazor_debugging_extension_prompt_shown';
305254
if (!server.sessionProperties[promptShownKey]) {
306255
server.sessionProperties[promptShownKey] = true;
307256

308257
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+
}
316263
}
317264
}

0 commit comments

Comments
 (0)