-
Notifications
You must be signed in to change notification settings - Fork 513
Windows environment variables in powershell.scriptAnalysis.settingsPath
#4268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Unfortunately, extension-provided settings such as this are explicitly not parsed for variable resolution by VS Code, and doing so in a post-processing manner would be quite difficult to get right. It's a neat idea, and I see the desire for it, but probably not something we're prioritizing at this point. I would point you toward VS Code setting profiles as a different approach to solve your problem. |
Please see microsoft/vscode#46471 for more context as to my contributed settings (like ours) can't support VS Code built-in (nor environment, through |
This issue has been marked as external. It has been automatically closed for housekeeping purposes. |
In case it help others: I've got this working using a symlink from # Assets
$Source = [string] '{0}\PSScriptAnalyzer.psd1' -f $env:PUBLIC
$Destination = [string] '{0}\_Share\AppData\PowerShell\Settings - PSScriptAnalyzer.psd1' -f $env:OneDriveConsumer
# Create symlink (requires admin unless Windows developer mode is enabled)
New-Item -ItemType 'SymbolicLink' -Path $Source -Value $Destination -Force Then in VSCode {
...
"powershell.scriptAnalysis.settingsPath": "C:\\Users\\Public\\PSScriptAnalyzer.psd1",
...
} I'd prefer if VSCode could use environment variables inside VSCode
Or the ability to configure PSScriptAnalyzer for |
Prerequisites
Summary
I'd like to be able to use Windows environment variables inside settings.json
powershell.scriptAnalysis.settingsPath
.From my testing it does not currently seem possible.
Why?
I'd like to be able to easily sync both Visual Studio Code settings.json and PSScriptAnalyzer settings file between devices.
Windows explorer
Path in Windows Explorer that resolves:
%OneDriveConsumer%\_Share\AppData\PowerShell\Settings-PSScriptAnalyzer.psd1
Settings.json
In settings.json I've tried the following.
Works (hard coded)
Does not work
Neither of these works.
Proposed Design
terminal.integrated.profiles.windows
setting."path": "${env:LOCALAPPDATA}\\Microsoft\\WindowsApps\\Microsoft.PowerShell_8wekyb3d8bbwe\\pwsh.exe"
\
,\\
,/
%APPDATA%
,${APPDATA}
,${env:APPDATA}
Relevant doc
The text was updated successfully, but these errors were encountered: