Skip to content

Commit

Permalink
debug improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
matepek committed Dec 1, 2022
1 parent d57880c commit 9595b38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions src/Configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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' },
Expand Down
8 changes: 6 additions & 2 deletions src/util/ResolveRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -313,3 +313,7 @@ export function createPythonIndexerForPathVariable(varName: string, pathStr: str
},
};
}

export function cloneRecursively<T>(value: T): T {
return _mapAllStrings(value, undefined, x => x) as T;
}

0 comments on commit 9595b38

Please sign in to comment.