Support for ${workspaceFolder}
and other variables in config
#1245
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
In some contexts of VSCode configuration there are a list of variables that can be substituted for values. Unfortunately VSCode doesn't support substituting those in user extensions out of the box.
Other extensions end up implementing full variable resolution themselves.
I've added a function that should be fairly easy to expand in coverage which starts adding support for these variable substitutions. Right now it's only being applied to
deno.path
but could be expanded to other config properties.Motivation
I'm using mise to manage Deno versions. There's a mise vscode extension that allows you to use symlinks in the .vscode directory of your repo to link all your tools. This is helpful if you're sharing vscode configuration with a team. To accomplish this, it saves the paths using
workspaceRoot
.Here's an example of the config in vsocde that it generates:
Note that
deno.path
uses${workspaceFolder}
. While it works for other extensions (python, ruff, node) it was failing for deno. At first I thought this extension just wasn't playing well with the symlinks (b/c I naively thought the path resolution for configuration was being handled automatically by vscode). Digging deeper, I realized that wasn't the case. This PR will resolve the issues I encountered and allow folks to use other variable substitutions for paths.Areas of improvement