Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
permissions: {}

env:
NODE_VERSION: 20.18.1
NODE_VERSION: 22.17.0
PYTHON_VERSION: '3.10' # YML treats 3.10 the number as 3.1, so quotes around 3.10
# Force a path with spaces and to test extension works in these scenarios
# Unicode characters are causing 2.7 failures so skip that for now.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
permissions: {}

env:
NODE_VERSION: 20.18.1
NODE_VERSION: 22.17.0
PYTHON_VERSION: '3.10' # YML treats 3.10 the number as 3.1, so quotes around 3.10
MOCHA_REPORTER_JUNIT: true # Use the mocha-multi-reporters and send output to both console (spec) and JUnit (mocha-junit-reporter). Also enables a reporter which exits the process running the tests if it haven't already.
ARTIFACT_NAME_VSIX: ms-python-insiders-vsix
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipeline.pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extends:
buildSteps:
- task: NodeTool@0
inputs:
versionSpec: '20.18.1'
versionSpec: '22.17.0'
displayName: Select Node version

- task: UsePythonVersion@0
Expand Down
2 changes: 1 addition & 1 deletion build/azure-pipeline.stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extends:
buildSteps:
- task: NodeTool@0
inputs:
versionSpec: '20.18.1'
versionSpec: '22.17.0'
displayName: Select Node version

- task: UsePythonVersion@0
Expand Down
6 changes: 3 additions & 3 deletions build/azure-pipelines/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ extends:
testPlatforms:
- name: Linux
nodeVersions:
- 20.18.1
- 22.17.0
- name: MacOS
nodeVersions:
- 20.18.1
- 22.17.0
- name: Windows
nodeVersions:
- 20.18.1
- 22.17.0
testSteps:
- template: /build/azure-pipelines/templates/test-steps.yml@self
parameters:
Expand Down
2 changes: 1 addition & 1 deletion pythonExtensionApi/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pythonExtensionApi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"main": "./out/main.js",
"types": "./out/main.d.ts",
"engines": {
"node": ">=20.18.1",
"node": ">=22.17.0",
"vscode": "^1.93.0"
},
"license": "MIT",
Expand All @@ -27,7 +27,7 @@
},
"devDependencies": {
"typescript": "~5.2",
"@types/vscode": "^1.93.0",
"@types/vscode": "^1.102.0",
"source-map": "^0.8.0-beta.0"
},
"scripts": {
Expand Down
9 changes: 5 additions & 4 deletions src/client/common/process/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export class ProcessLogger implements IProcessLogger {
let command = args
? [fileOrCommand, ...args].map((e) => e.trimQuotes().toCommandArgumentForPythonExt()).join(' ')
: fileOrCommand;
const info = [`> ${this.getDisplayCommands(command)}`];
const info = [`> ${this.getDisplayCommands(command, false)}`];
if (options?.cwd) {
const cwd: string = typeof options?.cwd === 'string' ? options?.cwd : options?.cwd?.toString();
info.push(`cwd: ${this.getDisplayCommands(cwd)}`);
info.push(`cwd: ${this.getDisplayCommands(cwd, true)}`);
}
if (typeof options?.shell === 'string') {
info.push(`shell: ${identifyShellFromShellPath(options?.shell)}`);
Expand All @@ -41,8 +41,9 @@ export class ProcessLogger implements IProcessLogger {
});
}

private getDisplayCommands(command: string): string {
if (this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) {
private getDisplayCommands(command: string, isCwd: boolean = false): string {
// Only replace workspace paths with '.' for cwd
if (isCwd && this.workspaceService.workspaceFolders && this.workspaceService.workspaceFolders.length === 1) {
command = replaceMatchesWithCharacter(command, this.workspaceService.workspaceFolders[0].uri.fsPath, '.');
}
const home = getUserHomeDir();
Expand Down
19 changes: 14 additions & 5 deletions src/test/common/process/logger.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,30 +146,39 @@ suite('ProcessLogger suite', () => {
sinon.assert.calledWithExactly(traceLogStub, `cwd: ${options.cwd}`);
});

test('Logger replaces the path to workspace with . if exactly one workspace folder is opened', async () => {
test('Logger only replaces the workspace path with . in the working directory', async () => {
const options = { cwd: path.join('path', 'to', 'workspace', 'debug', 'path') };
logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options);

sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`);
sinon.assert.calledWithExactly(
traceLogStub,
`> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`,
);
sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`);
});

test('On Windows, logger replaces both backwards and forward slash version of path to workspace with . if exactly one workspace folder is opened', async function () {
test('On Windows, logger handles both forward and backward slashes in workspace paths for cwd', async function () {
if (getOSType() !== OSType.Windows) {
return this.skip();
}
let options = { cwd: path.join('path/to/workspace', 'debug', 'path') };

logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options);

sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`);
sinon.assert.calledWithExactly(
traceLogStub,
`> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`,
);
sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`);
traceLogStub.resetHistory();

options = { cwd: path.join('path\\to\\workspace', 'debug', 'path') };
logger.logProcess(`"${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`, undefined, options);

sinon.assert.calledWithExactly(traceLogStub, `> ".${path.sep}test" "--foo" "--bar"`);
sinon.assert.calledWithExactly(
traceLogStub,
`> "${path.join('path', 'to', 'workspace', 'test')}" "--foo" "--bar"`,
);
sinon.assert.calledWithExactly(traceLogStub, `cwd: .${path.sep + path.join('debug', 'path')}`);
});

Expand Down
Loading