Skip to content

Commit

Permalink
Fix error in workspace (#101)
Browse files Browse the repository at this point in the history
* Fix error in workspace

* fix test and lint

* Fix format
  • Loading branch information
paulacamargo25 committed Sep 27, 2023
1 parent c3efd6d commit fbf3ca7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/extension/debugger/configuration/resolvers/attach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver<Attac
debugConfiguration.host = 'localhost';
}
if (debugConfiguration.justMyCode === undefined) {
debugConfiguration.justMyCode = getConfiguration('debugpy').get<boolean>('debugJustMyCode', true);
debugConfiguration.justMyCode = getConfiguration('debugpy', workspaceFolder).get<boolean>(
'debugJustMyCode',
true,
);
}
debugConfiguration.showReturnValue = debugConfiguration.showReturnValue !== false;
// Pass workspace folder so we can get this when we get debug events firing.
Expand Down
5 changes: 4 additions & 1 deletion src/extension/debugger/configuration/resolvers/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
debugConfiguration.debugOptions = [];
}
if (debugConfiguration.justMyCode === undefined) {
debugConfiguration.justMyCode = getConfiguration('debugpy').get<boolean>('debugJustMyCode', true);
debugConfiguration.justMyCode = getConfiguration('debugpy', workspaceFolder).get<boolean>(
'debugJustMyCode',
true,
);
}
// Pass workspace folder so we can get this when we get debug events firing.
debugConfiguration.workspaceFolder = workspaceFolder ? workspaceFolder.fsPath : undefined;
Expand Down
6 changes: 4 additions & 2 deletions src/test/unittest/configuration/resolvers/attach.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
getWorkspaceFoldersStub = sinon.stub(vscodeapi, 'getWorkspaceFolders');
getOSTypeStub.returns(osType);
getConfigurationStub = sinon.stub(vscodeapi, 'getConfiguration');
getConfigurationStub.withArgs('debugpy').returns(createMoqConfiguration(true));
getConfigurationStub.withArgs('debugpy', sinon.match.any).returns(createMoqConfiguration(true));
});

teardown(() => {
Expand Down Expand Up @@ -554,7 +554,9 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
.slice()
.concat(DebugOptions.Jinja, DebugOptions.Sudo) as DebugOptions[];

getConfigurationStub.withArgs('debugpy').returns(createMoqConfiguration(testParams.justMyCodeSetting));
getConfigurationStub
.withArgs('debugpy', sinon.match.any)
.returns(createMoqConfiguration(testParams.justMyCodeSetting));
const debugConfig = await resolveDebugConfiguration(workspaceFolder, {
...attach,
debugOptions,
Expand Down
6 changes: 4 additions & 2 deletions src/test/unittest/configuration/resolvers/launch.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
getEnvFileStub = sinon.stub(settings, 'getEnvFile');
getDebugEnvironmentVariablesStub = sinon.stub(helper, 'getDebugEnvironmentVariables');
getConfigurationStub = sinon.stub(vscodeapi, 'getConfiguration');
getConfigurationStub.withArgs('debugpy').returns(createMoqConfiguration(true));
getConfigurationStub.withArgs('debugpy', sinon.match.any).returns(createMoqConfiguration(true));
});

teardown(() => {
Expand Down Expand Up @@ -792,7 +792,9 @@ getInfoPerOS().forEach(([osName, osType, path]) => {
const pythonFile = 'xyz.py';
setupIoc(pythonPath);
setupActiveEditor(pythonFile, PYTHON_LANGUAGE);
getConfigurationStub.withArgs('debugpy').returns(createMoqConfiguration(testParams.justMyCodeSetting));
getConfigurationStub
.withArgs('debugpy', sinon.match.any)
.returns(createMoqConfiguration(testParams.justMyCodeSetting));
const debugConfig = await resolveDebugConfiguration(workspaceFolder, {
...launch,
justMyCode: testParams.justMyCode,
Expand Down

0 comments on commit fbf3ca7

Please sign in to comment.