Skip to content

Commit

Permalink
Fix adapter settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimcn committed Mar 11, 2023
1 parent 6649c20 commit c4e5a5b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions extension/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
workspace, window, commands, debug, extensions,
ExtensionContext, WorkspaceConfiguration, WorkspaceFolder, CancellationToken,
ExtensionContext, WorkspaceConfiguration, WorkspaceFolder, CancellationToken, ConfigurationScope,
DebugConfigurationProvider, DebugConfiguration, DebugAdapterDescriptorFactory, DebugSession, DebugAdapterExecutable,
DebugAdapterDescriptor, Uri, StatusBarAlignment, QuickPickItem, StatusBarItem, UriHandler, ConfigurationTarget,
DebugAdapterInlineImplementation
Expand Down Expand Up @@ -259,9 +259,9 @@ class Extension implements DebugConfigurationProvider, DebugAdapterDescriptorFac
}

// Read current adapter settings values from workspace configuration.
getAdapterSettings(folder: WorkspaceFolder = undefined): AdapterSettings {
folder = folder || debug.activeDebugSession?.workspaceFolder;
let config = this.getExtensionConfig(folder);
getAdapterSettings(scope: ConfigurationScope = undefined): AdapterSettings {
scope = scope || debug.activeDebugSession?.workspaceFolder;
let config = this.getExtensionConfig(scope);
let settings: AdapterSettings = {
displayFormat: config.get('displayFormat'),
showDisassembly: config.get('showDisassembly'),
Expand Down Expand Up @@ -386,8 +386,6 @@ class Extension implements DebugConfigurationProvider, DebugAdapterDescriptorFac
if (!await this.checkPrerequisites(folder))
return undefined;

let config = this.getExtensionConfig(folder);

let launchDefaults = this.getExtensionConfig(folder, 'lldb.launch');
launchConfig = this.mergeWorkspaceSettings(launchDefaults, launchConfig);

Expand Down Expand Up @@ -425,7 +423,7 @@ class Extension implements DebugConfigurationProvider, DebugAdapterDescriptorFac
launchConfig.sourceLanguages.push('rust');
}

launchConfig._adapterSettings = this.getAdapterSettings();
launchConfig._adapterSettings = this.getAdapterSettings(folder);

output.appendLine(`Resolved debug configuration: ${inspect(launchConfig)}`);
return launchConfig;
Expand Down Expand Up @@ -691,8 +689,8 @@ class Extension implements DebugConfigurationProvider, DebugAdapterDescriptorFac
});
}

getExtensionConfig(folder?: WorkspaceFolder, key: string = 'lldb'): WorkspaceConfiguration {
return workspace.getConfiguration(key, folder?.uri);
getExtensionConfig(scope?: ConfigurationScope, key: string = 'lldb'): WorkspaceConfiguration {
return workspace.getConfiguration(key, scope);
}
}

Expand Down

0 comments on commit c4e5a5b

Please sign in to comment.