Skip to content

Feat: Support for vscode settings expansions like ${workspaceFolder}#1790

Draft
Attempt3035 wants to merge 1 commit intomicrosoft:developfrom
Quasiflo:feat/vscode-variables
Draft

Feat: Support for vscode settings expansions like ${workspaceFolder}#1790
Attempt3035 wants to merge 1 commit intomicrosoft:developfrom
Quasiflo:feat/vscode-variables

Conversation

@Attempt3035
Copy link
Copy Markdown

Allows setting vscode settings with variable substitutions such as:

"java.import.gradle.java.home": "${workspaceFolder}/.vscode/mise-tools/java",
"java.import.gradle.user.home": "${workspaceFolder}/somewhere",
"java.import.gradle.home": "${workspaceFolder}/../../somewhereFarAway",

Also supports other substitutions available in vscode-variables package

PR currently open on vscode-java for same feature

@Attempt3035
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

import * as fse from "fs-extra";
import * as path from "path";
import { findDefaultRuntimeFromSettings, getMajorVersion, listJdks } from "./jdkUtils";
const vscodeVariables = require('vscode-variables');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use import syntax

"dependencies": {
"await-lock": "^2.2.2",
"jdk-utils": "^0.4.4",
"vscode-variables": "^1.0.1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a package officially support by microsoft?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so, source: https://github.com/DominicVonk/vscode-variables

I can implement the replacement logic manually if preferred, it's straightforward for simple cases like ${workspaceFolder} but vscode-variables does a good job at providing full functionality especially supporting multi root to end users

Copy link
Copy Markdown
Contributor

@chagong chagong Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if you can implement "resolve variables" in our repo. I think it only needs to resolve paths, no need to include commands & config stuff. Resolve commands might have some security concern.

@chagong
Copy link
Copy Markdown
Contributor

chagong commented Apr 2, 2026

Also fix the lint errors.

@Attempt3035 Attempt3035 marked this pull request as draft April 2, 2026 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants