Skip to content

Commit df03402

Browse files
authored
Merge pull request #405 from alcarney/workspace-folder
code: Add `${workspaceFolder}` support to `esbonio.server.pythonPath`
2 parents 931c5ad + 7885bd9 commit df03402

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

code/changes/404.fix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The ``esbonio.server.pythonPath`` setting now accepts paths relative to ``${workspaceFolder}``.
2+
3+
**Note** This is simply an alias for the existing ``${workspaceRoot}`` functionality.

code/src/lsp/python.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ export class PythonManager {
4848
if (userPython) {
4949

5050
// Support for ${workspaceRoot}/...
51-
let match = userPython.match(/^\${(\w+)}.*/)
52-
if (match && match[1] === 'workspaceRoot') {
51+
let match = userPython.match(/^\${(\w+)}/)
52+
if (match && (match[1] === 'workspaceRoot' || match[1] === 'workspaceFolder')) {
5353
let workspaceRoot = ""
5454
let workspaceFolders = vscode.workspace.workspaceFolders
5555

5656
if (workspaceFolders) {
5757
workspaceRoot = workspaceFolders[0].uri.fsPath
5858
}
5959

60-
userPython = userPython.replace("${workspaceRoot}", workspaceRoot)
60+
userPython = userPython.replace(match[0], workspaceRoot)
6161
}
6262

6363
this.logger.debug(`Using user configured Python: ${userPython}`)

docs/lsp/editors/vscode/_configuration.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The following options are available.
1717

1818
- ``/path/to/python/`` - An absolute path
1919
- ``${workspaceRoot}/../venv/bin/python`` - A path relative to the root of your workspace
20+
- ``${workspaceFolder}/../venv/bin/python`` - Same as ``${workspaceRoot}``, placeholder for true multi-root workspace support.
2021

2122
.. confval:: esbonio.server.installBehavior (string)
2223

0 commit comments

Comments
 (0)