Skip to content

Commit

Permalink
Add logic to replace tilde with home environment (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
MGasiewski authored Mar 8, 2024
1 parent aaf0f4f commit aafe440
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ function resolveVariables(
const home = process.env.HOME || process.env.USERPROFILE;
if (home) {
substitutions.set('${userHome}', home);
substitutions.set('~', home);
}
if (workspace) {
substitutions.set('${workspaceFolder}', workspace.uri.fsPath);
}

substitutions.set('${cwd}', process.cwd());
getWorkspaceFolders().forEach((w) => {
substitutions.set('${workspaceFolder:' + w.name + '}', w.uri.fsPath);
Expand Down
2 changes: 2 additions & 0 deletions src/test/ts_tests/tests/common/settings.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ suite('Settings Tests', () => {
'${workspaceFolder}/lib/python',
'${workspaceFolder:workspace1}/lib/python',
'${cwd}/lib/python',
'~/lib/python',
])
.verifiable(TypeMoq.Times.atLeastOnce());
pythonConfigMock
Expand All @@ -286,6 +287,7 @@ suite('Settings Tests', () => {
`${workspace1.uri.fsPath}/lib/python`,
`${workspace1.uri.fsPath}/lib/python`,
`${process.cwd()}/lib/python`,
`${process.env.HOME || process.env.USERPROFILE}/lib/python`,
]);

configMock.verifyAll();
Expand Down

0 comments on commit aafe440

Please sign in to comment.