diff --git a/code/changes/404.fix.rst b/code/changes/404.fix.rst new file mode 100644 index 000000000..ee346037d --- /dev/null +++ b/code/changes/404.fix.rst @@ -0,0 +1,3 @@ +The ``esbonio.server.pythonPath`` setting now accepts paths relative to ``${workspaceFolder}``. + +**Note** This is simply an alias for the existing ``${workspaceRoot}`` functionality. diff --git a/code/src/lsp/python.ts b/code/src/lsp/python.ts index 01e368103..606d5346a 100644 --- a/code/src/lsp/python.ts +++ b/code/src/lsp/python.ts @@ -48,8 +48,8 @@ export class PythonManager { if (userPython) { // Support for ${workspaceRoot}/... - let match = userPython.match(/^\${(\w+)}.*/) - if (match && match[1] === 'workspaceRoot') { + let match = userPython.match(/^\${(\w+)}/) + if (match && (match[1] === 'workspaceRoot' || match[1] === 'workspaceFolder')) { let workspaceRoot = "" let workspaceFolders = vscode.workspace.workspaceFolders @@ -57,7 +57,7 @@ export class PythonManager { workspaceRoot = workspaceFolders[0].uri.fsPath } - userPython = userPython.replace("${workspaceRoot}", workspaceRoot) + userPython = userPython.replace(match[0], workspaceRoot) } this.logger.debug(`Using user configured Python: ${userPython}`) diff --git a/docs/lsp/editors/vscode/_configuration.rst b/docs/lsp/editors/vscode/_configuration.rst index 3dd4c7a58..213393583 100644 --- a/docs/lsp/editors/vscode/_configuration.rst +++ b/docs/lsp/editors/vscode/_configuration.rst @@ -17,6 +17,7 @@ The following options are available. - ``/path/to/python/`` - An absolute path - ``${workspaceRoot}/../venv/bin/python`` - A path relative to the root of your workspace + - ``${workspaceFolder}/../venv/bin/python`` - Same as ``${workspaceRoot}``, placeholder for true multi-root workspace support. .. confval:: esbonio.server.installBehavior (string)