From f865b631fd7b66eab5501eb5d2acd05e21e22efc Mon Sep 17 00:00:00 2001 From: Haneef Mohammed Date: Tue, 6 Jun 2023 08:35:04 -0700 Subject: [PATCH] Issue #896. Proper handling of OS overrides for settings --- CHANGELOG.md | 1 + package.json | 2 +- src/frontend/configprovider.ts | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa9face9..4d821e39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Issue #861: Potential fix * Issue #867: STLink make it so that user has to enable `-shared` if needed. Before it was automatically added to the command-line and there was no (good) way to remove it * Issue #882: Potential fix. In some cases the extension would crash while single stepping +* Issue #896: Bug in handling of OS specific overrides (like `cortex-debug.gdbPath.linux`) # V1.11.2 * Minor bug fix to guard against invalid expressions (watch and live watch) diff --git a/package.json b/package.json index c1a522f3..07e88450 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.11.3-pre4", + "version": "1.11.3-pre5", "preview": false, "activationEvents": [ "onDebugResolve:cortex-debug", diff --git a/src/frontend/configprovider.ts b/src/frontend/configprovider.ts index d5c808c5..4f28f33d 100644 --- a/src/frontend/configprovider.ts +++ b/src/frontend/configprovider.ts @@ -411,10 +411,18 @@ export class CortexDebugConfigurationProvider implements vscode.DebugConfigurati private setOsSpecficConfigSetting(config: vscode.DebugConfiguration, dstName: string, propName: string = '') { if (!config[dstName]) { - const configuration = vscode.workspace.getConfiguration('cortex-debug'); - const osName = os.platform(); - const osOverride = (propName || dstName) + '.' + ((osName === 'win32') ? 'windows' : (osName === 'darwin') ? 'osx' : 'linux'); - config[dstName] = configuration.get(osOverride, configuration.get(propName || dstName, '')); + propName = propName || dstName; + const settings = vscode.workspace.getConfiguration('cortex-debug'); + const obj = settings[propName]; + if (obj) { + if (typeof obj === 'object') { + const osName = os.platform(); + const osOverride = ((osName === 'win32') ? 'windows' : (osName === 'darwin') ? 'osx' : 'linux'); + config[dstName] = obj[osOverride] || ''; + } else { + config[dstName] = obj; + } + } } }