Support for ${workspaceFolder} and other variables in config#1245
Support for ${workspaceFolder} and other variables in config#1245just-be-dev wants to merge 1 commit intodenoland:mainfrom
${workspaceFolder} and other variables in config#1245Conversation
90bfb74 to
0b746e2
Compare
6b1f768 to
222e836
Compare
|
Most settings are processed server-side at https://github.com/denoland/deno/tree/v2.1.7/cli/lsp. We're likely to let this be an upstream issue for vscode. One reason this wouldn't work otherwise is if you specify Thanks for opening this PR but we're going to leave this for vscode. |
|
It's unlikely support for this will ever land upstream. The original issue for this was opened in 2016. I certainly empathize with the complexity around multi-workspace setups. This is a best effort implementation. The I'm willing to work through a more robust implementation if there's appetite for it. |
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.pathbut 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.pathuses${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