From 7c9b50329b5282f261927cad89729362c8359c13 Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Fri, 29 Sep 2023 16:22:19 -0700 Subject: [PATCH 1/2] Debugger: Update configuration snippets and 'hiddenWhen' This PR makes a few tweaks to package.json to hopefully further improve the experience configuring projects to launch -- 1. This adds a configuration snippet that uses the `dotnet` type to aid folks in using `dotnet` debugger type in polygot workspaces 2. This hides the `C#` configuration provider if you try and bring up an action that will show you available debuggers when DevKit is not available 3. This hides the `clr` configuration provider in all cases, since clicking it would do nothing --- package.json | 44 ++++++++++++++++++++++++++++---------------- package.nls.json | 15 +++++++++++++++ 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index b9d87d2ea..9ec02d5ec 100644 --- a/package.json +++ b/package.json @@ -3283,8 +3283,8 @@ }, "configurationSnippets": [ { - "label": ".NET: Launch .NET Core Console App", - "description": "Launch a .NET Core Console App with a debugger.", + "label": "%debuggers.coreclr.configurationSnippets.label.console-local%", + "description": "%debuggers.coreclr.configurationSnippets.description.console-local%", "body": { "name": ".NET Core Launch (console)", "type": "coreclr", @@ -3298,8 +3298,8 @@ } }, { - "label": ".NET: Attach to local .NET Core Console App", - "description": "Attach a debugger to a .NET Core Console App.", + "label": "%debuggers.coreclr.configurationSnippets.label.attach-local%", + "description": "%debuggers.coreclr.configurationSnippets.description.attach%", "body": { "name": ".NET Core Attach", "type": "coreclr", @@ -3307,8 +3307,8 @@ } }, { - "label": ".NET: Launch a local .NET Core Web App", - "description": "Launch a .NET Core Web App with both a browser and a debugger.", + "label": "%debuggers.coreclr.configurationSnippets.label.web-local%", + "description": "%debuggers.coreclr.configurationSnippets.description.web-local%", "body": { "name": ".NET Core Launch (web)", "type": "coreclr", @@ -3331,8 +3331,8 @@ } }, { - "label": ".NET: Launch a remote .NET Core Console App", - "description": "Launch a .NET Core Console App on a remote machine.", + "label": "%debuggers.coreclr.configurationSnippets.label.console-remote%", + "description": "%debuggers.coreclr.configurationSnippets.description.remote%", "body": { "name": ".NET Core Launch (console)", "type": "coreclr", @@ -3352,8 +3352,8 @@ } }, { - "label": ".NET: Attach to remote .NET Core Console App", - "description": "Attach a debugger to a .NET Core Console App on a remote machine.", + "label": "%debuggers.coreclr.configurationSnippets.label.attach-remote%", + "description": "%debuggers.coreclr.configurationSnippets.description.remote%", "body": { "name": ".NET Core Attach", "type": "coreclr", @@ -3367,8 +3367,8 @@ } }, { - "label": ".NET: Launch and Debug Hosted Blazor WebAssembly App", - "description": "Launches a Hosted Blazor WebAssembly App with a debugger", + "label": "%debuggers.coreclr.configurationSnippets.label.blazor-hosted%", + "description": "%debuggers.coreclr.configurationSnippets.description.blazor-hosted%", "body": { "name": "Launch and Debug Hosted Blazor WebAssembly App", "type": "blazorwasm", @@ -3379,8 +3379,8 @@ } }, { - "label": ".NET: Launch and Debug Standalone Blazor WebAssembly App", - "description": "Launches Standalone Blazor WebAssembly App with a debugger", + "label": "%debuggers.coreclr.configurationSnippets.label.blazor-standalone%", + "description": "%debuggers.coreclr.configurationSnippets.description.blazor-standalone%", "body": { "name": "Launch and Debug Standalone Blazor WebAssembly App", "type": "blazorwasm", @@ -3393,7 +3393,7 @@ { "type": "clr", "when": "workspacePlatform == windows", - "hiddenWhen": "dotnet.debug.serviceBrokerAvailable", + "hiddenWhen": "true", "label": ".NET Framework 4.x", "languages": [ "csharp", @@ -4766,6 +4766,7 @@ { "type": "dotnet", "label": "C#", + "hiddenWhen": "!dotnet.debug.serviceBrokerAvailable", "languages": [ "csharp", "razor", @@ -4792,7 +4793,18 @@ } } }, - "configurationSnippets": [] + "configurationSnippets": [ + { + "label": "%debuggers.dotnet.configurationSnippets.label%", + "description": "%debuggers.dotnet.configurationSnippets.description%", + "body": { + "name": "C#: ${1:} Debug", + "type": "dotnet", + "request": "launch", + "projectPath": "^\"\\${workspaceFolder}/${2:}${1:}.csproj\"" + } + } + ] } ], "semanticTokenTypes": [ diff --git a/package.nls.json b/package.nls.json index 23659fa87..40c8e41f2 100644 --- a/package.nls.json +++ b/package.nls.json @@ -75,8 +75,23 @@ "configuration.razor.trace.off": "Does not log messages from the Razor extension", "configuration.razor.trace.messages": "Logs only some messages from the Razor extension", "configuration.razor.trace.verbose": "Logs all messages from the Razor extension", + "debuggers.coreclr.configurationSnippets.label.console-local": ".NET: Launch Executable file (Console)", + "debuggers.coreclr.configurationSnippets.label.web-local": ".NET: Launch Executable file (Web)", + "debuggers.coreclr.configurationSnippets.label.attach-local": ".NET: Attach to a .NET process", + "debuggers.coreclr.configurationSnippets.label.console-remote": ".NET: Remote debugging - Launch Executable file (Console)", + "debuggers.coreclr.configurationSnippets.label.attach-remote": ".NET: Remote debugging - Attach to a .NET process", + "debuggers.coreclr.configurationSnippets.label.blazor-hosted": ".NET: Web Assembly - Launch hosted Blazor project", + "debuggers.coreclr.configurationSnippets.label.blazor-standalone": ".NET: Web Assembly - Launch standalone Blazor project", + "debuggers.coreclr.configurationSnippets.description.console-local": "This snippet is used to launch a new process under the .NET debugger (coreclr), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice. This snippet is useful when the project was built outside this VS Code instance or you want to host your .NET Code in a custom executable, such as a specific version of `dotnet` or the .NET Code is hosted by a native application. This snippet is for console applications.", + "debuggers.coreclr.configurationSnippets.description.web-local": "This snippet is used to launch a new process under the .NET debugger (coreclr), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice. This snippet is useful when the project was built outside this VS Code instance or you want to host your .NET Code in a custom executable, such as a specific version of `dotnet` or the .NET Code is hosted by a native application. This snippet is for web (ASP.NET Core) applications.", + "debuggers.coreclr.configurationSnippets.description.attach": "Attach the .NET debugger (coreclr) to a running process. This can also be done using the 'Attach to a .NET 5+ or .NET Core process' command.", + "debuggers.coreclr.configurationSnippets.description.remote": "This snippet shows how to remote debug .NET Code **without** using VS Code remoting. It should be used in cases where you want to build your project locally but run it on another computer.", + "debuggers.coreclr.configurationSnippets.description.blazor-hosted": "This snippet is used to launch a new process under the Blazor WebAssembly debugger (blazorwasm), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice, but this snippet can be used to have full control over all launch options. This snippet is for hosted Blazor projects, which is a project that has a backend ASP.NET Core app to serve its files.", + "debuggers.coreclr.configurationSnippets.description.blazor-standalone": "This snippet is used to launch a new process under the Blazor WebAssembly debugger (blazorwasm). In most cases, the \".NET: Launch C# project\" snippet is a better choice, but this snippet can be used to have full control over all launch options. This snippet is for standalone Blazor projects, which is a project that does not have a backend ASP.NET Core app to serve its files.", "debuggers.dotnet.launch.projectPath.description": "Path to the .csproj file.", "debuggers.dotnet.launch.launchConfigurationId.description": "The launch configuration id to use. Empty string will use the current active configuration.", + "debuggers.dotnet.configurationSnippets.label": ".NET: Launch C# project", + "debuggers.dotnet.configurationSnippets.description": "This snippet configures VS Code to debug a C# project. Debug options (example: arguments to the executable) can be configured through the '/Properties/launchSettings.json' file.", "viewsWelcome.debug.contents": { "message": "[Generate C# Assets for Build and Debug](command:dotnet.generateAssets)\n\nTo learn more about launch.json, see [Configuring launch.json for C# debugging](https://aka.ms/VSCode-CS-LaunchJson).", "comment": [ From fa6dea3b641a5762452edcfc3d27174b12d1bd9c Mon Sep 17 00:00:00 2001 From: Gregg Miskelly Date: Fri, 29 Sep 2023 17:28:52 -0700 Subject: [PATCH 2/2] Add `Locked` comments and update dotnet.exe name --- package.nls.json | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/package.nls.json b/package.nls.json index 40c8e41f2..44c4fffff 100644 --- a/package.nls.json +++ b/package.nls.json @@ -82,12 +82,42 @@ "debuggers.coreclr.configurationSnippets.label.attach-remote": ".NET: Remote debugging - Attach to a .NET process", "debuggers.coreclr.configurationSnippets.label.blazor-hosted": ".NET: Web Assembly - Launch hosted Blazor project", "debuggers.coreclr.configurationSnippets.label.blazor-standalone": ".NET: Web Assembly - Launch standalone Blazor project", - "debuggers.coreclr.configurationSnippets.description.console-local": "This snippet is used to launch a new process under the .NET debugger (coreclr), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice. This snippet is useful when the project was built outside this VS Code instance or you want to host your .NET Code in a custom executable, such as a specific version of `dotnet` or the .NET Code is hosted by a native application. This snippet is for console applications.", - "debuggers.coreclr.configurationSnippets.description.web-local": "This snippet is used to launch a new process under the .NET debugger (coreclr), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice. This snippet is useful when the project was built outside this VS Code instance or you want to host your .NET Code in a custom executable, such as a specific version of `dotnet` or the .NET Code is hosted by a native application. This snippet is for web (ASP.NET Core) applications.", - "debuggers.coreclr.configurationSnippets.description.attach": "Attach the .NET debugger (coreclr) to a running process. This can also be done using the 'Attach to a .NET 5+ or .NET Core process' command.", + "debuggers.coreclr.configurationSnippets.description.console-local": { + "message" : "This snippet is used to launch a new process under the .NET debugger (coreclr), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice. This snippet is useful when the project was built outside this VS Code instance or you want to host your .NET Code in a custom executable, such as a specific version of 'dotnet.exe'/'dotnet' or the .NET Code is hosted by a native application. This snippet is for console applications.", + "comment": [ + "'coreclr' is the name of the debugger 'type', and should not be localized", + "{Locked='(coreclr)'}" + ] + }, + "debuggers.coreclr.configurationSnippets.description.web-local": { + "message": "This snippet is used to launch a new process under the .NET debugger (coreclr), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice. This snippet is useful when the project was built outside this VS Code instance or you want to host your .NET Code in a custom executable, such as a specific version of 'dotnet.exe'/'dotnet' or the .NET Code is hosted by a native application. This snippet is for web (ASP.NET Core) applications.", + "comment": [ + "'coreclr' is the name of the debugger 'type', and should not be localized", + "{Locked='(coreclr)'}" + ] + }, + "debuggers.coreclr.configurationSnippets.description.attach": { + "message": "Attach the .NET debugger (coreclr) to a running process. This can also be done using the 'Attach to a .NET 5+ or .NET Core process' command.", + "comment": [ + "'coreclr' is the name of the debugger 'type', and should not be localized", + "{Locked='(coreclr)'}" + ] + }, "debuggers.coreclr.configurationSnippets.description.remote": "This snippet shows how to remote debug .NET Code **without** using VS Code remoting. It should be used in cases where you want to build your project locally but run it on another computer.", - "debuggers.coreclr.configurationSnippets.description.blazor-hosted": "This snippet is used to launch a new process under the Blazor WebAssembly debugger (blazorwasm), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice, but this snippet can be used to have full control over all launch options. This snippet is for hosted Blazor projects, which is a project that has a backend ASP.NET Core app to serve its files.", - "debuggers.coreclr.configurationSnippets.description.blazor-standalone": "This snippet is used to launch a new process under the Blazor WebAssembly debugger (blazorwasm). In most cases, the \".NET: Launch C# project\" snippet is a better choice, but this snippet can be used to have full control over all launch options. This snippet is for standalone Blazor projects, which is a project that does not have a backend ASP.NET Core app to serve its files.", + "debuggers.coreclr.configurationSnippets.description.blazor-hosted": { + "message": "This snippet is used to launch a new process under the Blazor WebAssembly debugger (blazorwasm), specifying the path to the executable to launch. In most cases, the \".NET: Launch C# project\" snippet is a better choice, but this snippet can be used to have full control over all launch options. This snippet is for hosted Blazor projects, which is a project that has a backend ASP.NET Core app to serve its files.", + "comment": [ + "'blazorwasm' is the name of the debugger 'type', and should not be localized", + "{Locked='(blazorwasm)'}" + ] + }, + "debuggers.coreclr.configurationSnippets.description.blazor-standalone": { + "message": "This snippet is used to launch a new process under the Blazor WebAssembly debugger (blazorwasm). In most cases, the \".NET: Launch C# project\" snippet is a better choice, but this snippet can be used to have full control over all launch options. This snippet is for standalone Blazor projects, which is a project that does not have a backend ASP.NET Core app to serve its files.", + "comment": [ + "'blazorwasm' is the name of the debugger 'type', and should not be localized", + "{Locked='(blazorwasm)'}" + ] + }, "debuggers.dotnet.launch.projectPath.description": "Path to the .csproj file.", "debuggers.dotnet.launch.launchConfigurationId.description": "The launch configuration id to use. Empty string will use the current active configuration.", "debuggers.dotnet.configurationSnippets.label": ".NET: Launch C# project",