diff --git a/CHANGELOG.md b/CHANGELOG.md index b470bc7f..c061f78d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +## [4.3.7] + ## [4.3.6] - 2022-12-01 ## [4.3.5] - 2022-11-28 diff --git a/src/Configurations.ts b/src/Configurations.ts index dcd8c840..fe8aed2c 100644 --- a/src/Configurations.ts +++ b/src/Configurations.ts @@ -13,6 +13,7 @@ import { ExecutionWrapperConfig, } from './AdvancedExecutableInterface'; import { platformUtil } from './util/Platform'; +import { cloneRecursively } from './util/ResolveRule'; type SentryValue = 'question' | 'enable' | 'enabled' | 'disable' | 'disable_1' | 'disable_2' | 'disable_3'; @@ -112,12 +113,9 @@ export class Configurations { }; if (typeof templateFromConfig === 'object' && templateFromConfig !== null) { - Object.assign(template, templateFromConfig); - // assign does not unwrap Proxy so we have to do it - //https://github.com/matepek/vscode-catch2-test-adapter/issues/369 - template[setEnvKey] = Object.assign({}, templateFromConfig[setEnvKey]); + // we need this trick to get rid of the proxy, because asigns works on proxy but not on it's children + Object.assign(template, cloneRecursively(templateFromConfig)); this._log.debug('template', template); - return { template, source: 'userDefined', launchSourceFileMap: {} }; } else if (templateFromConfig === null) { const wpLaunchConfigs = vscode.workspace @@ -242,7 +240,6 @@ export class Configurations { return { template, source: 'webfreak.debug', launchSourceFileMap: {} }; } else if (this._hasExtension('ms-vscode.cpptools')) { - // documentation says debug"environment" = [{...}] but that doesn't work Object.assign(template, { type: 'cppvsdbg', linux: { type: 'cppdbg', MIMode: 'gdb' }, diff --git a/src/util/ResolveRule.ts b/src/util/ResolveRule.ts index eb082718..560d7b65 100644 --- a/src/util/ResolveRule.ts +++ b/src/util/ResolveRule.ts @@ -100,13 +100,13 @@ async function replaceAllRegExp( const newStr: string[] = []; while (m && m.index !== undefined) { - newStr.push(remainingStr.substr(0, m.index)); + newStr.push(remainingStr.substring(0, m.index)); const ruleV = await rule(m); if (typeof ruleV !== 'string') throw Error('resolveVariables regex func return type should be string'); newStr.push(ruleV); - remainingStr = remainingStr.substr(m.index + m[0].length); + remainingStr = remainingStr.substring(m.index + m[0].length); m = remainingStr.match(resolve); } @@ -313,3 +313,7 @@ export function createPythonIndexerForPathVariable(varName: string, pathStr: str }, }; } + +export function cloneRecursively(value: T): T { + return _mapAllStrings(value, undefined, x => x) as T; +}