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 91cbea9 commit d91ee16
Show file tree
Hide file tree
Showing 5 changed files with 25 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.6]

## [4.3.5] - 2022-11-28

## [4.3.4] - 2022-10-28
Expand Down
7 changes: 7 additions & 0 deletions src/Configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class ConfigurationChangeEvent {

///

export const setEnvKey = 'testMate.cpp.debug.setEnv';

///

export class Configurations {
private _cfg: vscode.WorkspaceConfiguration;

Expand Down Expand Up @@ -109,6 +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]);
this._log.debug('template', template);

return { template, source: 'userDefined', launchSourceFileMap: {} };
Expand Down
10 changes: 5 additions & 5 deletions src/WorkspaceManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { Config, Configurations } from './Configurations';
import { Config, Configurations, setEnvKey } from './Configurations';
import { LoggerWrapper } from './LoggerWrapper';
import {
createPythonIndexerForArray,
Expand Down Expand Up @@ -279,12 +279,12 @@ export class WorkspaceManager implements vscode.Disposable {
executables: Map<AbstractExecutable, TestsToRun>,
cancellation: vscode.CancellationToken,
run: vscode.TestRun,
): Thenable<void> {
): Promise<void> {
for (const exec of executables.values()) for (const test of exec) run.enqueued(test.item);

return this._runInner(executables, cancellation, run).catch(e => {
this.log.errorS('error during run', e);
debugger;
throw e;
});
}

Expand Down Expand Up @@ -380,11 +380,12 @@ export class WorkspaceManager implements vscode.Disposable {
}
}

debug(test: AbstractTest, cancellation: vscode.CancellationToken, run: vscode.TestRun): Thenable<void> {
debug(test: AbstractTest, cancellation: vscode.CancellationToken, run: vscode.TestRun): Promise<void> {
run.enqueued(test.item);

return this._debugInner(test, cancellation, run).catch(e => {
this.log.errorS('error during debug', e);
throw e;
});
}

Expand Down Expand Up @@ -417,7 +418,6 @@ export class WorkspaceManager implements vscode.Disposable {
const envVars = Object.assign({}, process.env, executable.shared.options.env);

{
const setEnvKey = 'testMate.cpp.debug.setEnv';
if (typeof debugConfigData.template[setEnvKey] === 'object') {
for (const envName in debugConfigData.template[setEnvKey]) {
const envValue = debugConfigData.template[setEnvKey][envName];
Expand Down
12 changes: 10 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
const runQueue: Thenable<void>[] = [];

for (const [manager, executables] of managers) {
runQueue.push(manager.run(executables, cancellation, testRun));
runQueue.push(
manager.run(executables, cancellation, testRun).catch(e => {
vscode.window.showErrorMessage('Unexpected error from run: ' + e);
}),
);
}

await Promise.allSettled(runQueue);
Expand Down Expand Up @@ -200,7 +204,11 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
return;
}
const test = testsToRun.direct[0];
runQueue.push(manager.debug(test, cancellation, testRun));
runQueue.push(
manager.debug(test, cancellation, testRun).catch(e => {
vscode.window.showErrorMessage('Unexpected error from debug: ' + e);
}),
);
}

await Promise.allSettled(runQueue);
Expand Down
2 changes: 1 addition & 1 deletion test/cpp/catch2/Catch2v3Test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include(FetchContent)

FetchContent_Declare(catch2v3test
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.0-preview5)
GIT_TAG v3.1.1)

FetchContent_GetProperties(catch2v3test)
if(NOT catch2v3test_POPULATED)
Expand Down

0 comments on commit d91ee16

Please sign in to comment.