Skip to content

Commit

Permalink
Add the AutomaticSourceLinkDownload option
Browse files Browse the repository at this point in the history
  • Loading branch information
JaneySprings committed May 4, 2024
1 parent affdc4d commit 5344467
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
"dotnetMeteor.debuggerOptions.useExternalTypeResolver": {
"type": "boolean",
"default": true,
"markdownDescription": "%configuration.description.debuggerOptions.useExternalTypeResolver%"
"description": "%configuration.description.debuggerOptions.useExternalTypeResolver%"
},
"dotnetMeteor.debuggerOptions.currentExceptionTag": {
"type": "string",
Expand Down Expand Up @@ -282,6 +282,11 @@
"default": false,
"description": "%configuration.description.debuggerOptions.searchMicrosoftSymbolServer%"
},
"dotnetMeteor.debuggerOptions.automaticSourcelinkDownload": {
"type": "boolean",
"default": true,
"description": "%configuration.description.debuggerOptions.automaticSourcelinkDownload%"
},
"dotnetMeteor.debuggerOptions.integerDisplayFormat": {
"type": "string",
"default": "Decimal",
Expand Down
5 changes: 3 additions & 2 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"configuration.description.debuggerOptions.flattenHierarchy": "Controls whether the debugger should flatten the hierarchy of inherited members.",
"configuration.description.debuggerOptions.groupPrivateMembers": "Controls whether the debugger should group private members in the debugging window.",
"configuration.description.debuggerOptions.groupStaticMembers": "Controls whether the debugger should group static members in the debugging window.",
"configuration.description.debuggerOptions.useExternalTypeResolver": "Use an external type resolver to resolve types in the debugging window. Requires the [DotRush](https://marketplace.visualstudio.com/items?itemName=nromanov.dotrush) extension.",
"configuration.description.debuggerOptions.useExternalTypeResolver": "Search for unknown types in the project's assemblies for the evaluation expressions.",
"configuration.description.debuggerOptions.currentExceptionTag": "Specifies the display name of the current exception in the debugging window.",
"configuration.description.debuggerOptions.ellipsizeStrings": "Truncates strings in the debugging window.",
"configuration.description.debuggerOptions.ellipsizedLength": "The maximum length of a truncated string.",
Expand All @@ -45,5 +45,6 @@
"configuration.description.debuggerOptions.searchMicrosoftSymbolServer": "Search for symbols on the Microsoft Symbol Server.",
"configuration.description.debuggerOptions.searchNuGetSymbolServer": "Search for symbols on the NuGet Symbol Server.",
"configuration.description.debuggerOptions.integerDisplayFormat": "Specifies the format of displayed integers in the debugging window.",
"configuration.description.debuggerOptions.sourceCodeMappings": "Modifies locations for the debugged source code by replacing values on the left with values on the right."
"configuration.description.debuggerOptions.sourceCodeMappings": "Modifies locations for the debugged source code by replacing values on the left with values on the right.",
"configuration.description.debuggerOptions.automaticSourcelinkDownload": "Automatically downloads source files from the SourceLink."
}
3 changes: 3 additions & 0 deletions src/DotNet.Meteor.Debug/DebugOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class DebugOptions {
[JsonPropertyName("source_code_mappings")]
public ImmutableDictionary<string, string> SourceCodeMappings { get; set; } = ServerExtensions.DefaultDebuggerOptions.SourceCodeMappings;

[JsonPropertyName("automatic_sourcelink_download")]
public bool AutomaticSourceLinkDownload { get; set; } = ServerExtensions.DefaultDebuggerOptions.AutomaticSourceLinkDownload;

internal static IntegerDisplayFormat GetIntegerDisplayFormat(string value) {
if (value == Mono.Debugging.Client.IntegerDisplayFormat.Decimal.ToString())
return Mono.Debugging.Client.IntegerDisplayFormat.Decimal;
Expand Down
2 changes: 1 addition & 1 deletion src/DotNet.Meteor.Debug/DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ protected override StackTraceResponse HandleStackTraceRequest(StackTraceArgument
SourceReference = 0
};
}
if (source == null && frame.SourceLocation.SourceLink != null) {
if (source == null && frame.SourceLocation.SourceLink != null && session.Options.AutomaticSourceLinkDownload) {
var path = SymbolServerExtensions.DownloadSourceFile(frame.SourceLocation.SourceLink.Uri);
source = new DebugProtocol.Source() {
Name = Path.GetFileName(path),
Expand Down
1 change: 1 addition & 0 deletions src/DotNet.Meteor.Debug/LaunchConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ private static DebuggerSessionOptions GetDebuggerSessionOptions(JToken debuggerJ
debuggerOptions.SearchMicrosoftSymbolServer = options.SearchMicrosoftSymbolServer;
debuggerOptions.SearchNuGetSymbolServer = options.SearchNuGetSymbolServer;
debuggerOptions.SourceCodeMappings = options.SourceCodeMappings;
debuggerOptions.AutomaticSourceLinkDownload = options.AutomaticSourceLinkDownload;

return debuggerOptions;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mono.Debugger
3 changes: 2 additions & 1 deletion src/VSCode.Extension/configurationController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export class ConfigurationController {
project_assemblies_only: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsProjectAssembliesOnly),
step_over_properties_and_operators: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsStepOverPropertiesAndOperators),
search_microsoft_symbol_server: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsSearchMicrosoftSymbolServer),
source_code_mappings: ConfigurationController.getSettingOrDefault<any>(res.configIdDebuggerOptionsSourceCodeMappings)
source_code_mappings: ConfigurationController.getSettingOrDefault<any>(res.configIdDebuggerOptionsSourceCodeMappings),
automatic_sourcelink_download: ConfigurationController.getSettingOrDefault<boolean>(res.configIdDebuggerOptionsAutomaticSourcelinkDownload),
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/VSCode.Extension/resources/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ export const configIdDebuggerOptionsProjectAssembliesOnly = `${configIdDebuggerO
export const configIdDebuggerOptionsStepOverPropertiesAndOperators = `${configIdDebuggerOptions}.stepOverPropertiesAndOperators`;
export const configIdDebuggerOptionsSearchMicrosoftSymbolServer = `${configIdDebuggerOptions}.searchMicrosoftSymbolServer`;
export const configIdDebuggerOptionsSearchNuGetSymbolServer = `${configIdDebuggerOptions}.searchNugetSymbolServer`;
export const configIdDebuggerOptionsSourceCodeMappings = `${configIdDebuggerOptions}.sourceCodeMappings`;
export const configIdDebuggerOptionsSourceCodeMappings = `${configIdDebuggerOptions}.sourceCodeMappings`;
export const configIdDebuggerOptionsAutomaticSourcelinkDownload = `${configIdDebuggerOptions}.automaticSourcelinkDownload`;

0 comments on commit 5344467

Please sign in to comment.