Skip to content

Commit f415367

Browse files
authored
docs: update VSCode terminal configuration for Windows users (#339)
Currently, Visual Studio Code's `terminal.integrated.shell.*` and `terminal.integrated.shellArgs.*` are deprecated. So I tried `terminal.integrated.profiles.windows` to replace source configurations, and I found that it can still run normally if it is not installed in the default directory (the specific situation has not been studied in depth).
1 parent e7828d5 commit f415367

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

guides/windows.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ cmd /k "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxili
5656

5757
## Visual Studio Code users using ElixirLS
5858

59-
> Assuming you have _latest_ version of Build Tools, aligned with Visual Studio **2022**,
60-
installed in its default installation path.
59+
> Assuming you have _latest_ version of Build Tools, aligned with Visual Studio **2022**.
6160
6261
Start Visual Studio Code from a PowerShell prompt within your project folder.
6362

@@ -76,10 +75,45 @@ Within your global `settings.json` or your workspace `.vscode\settings.json` add
7675

7776
```json
7877
{
79-
"terminal.integrated.shell.windows": "cmd.exe",
80-
"terminal.integrated.shellArgs.windows": [
81-
"/k",
82-
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"
83-
]
78+
"terminal.integrated.defaultProfile.windows": "PowerShell for VS2022",
79+
// You can select one you like.
80+
"terminal.integrated.profiles.windows": {
81+
"Command Prompt for VS2022": {
82+
"path": [
83+
"${env:windir}\\Sysnative\\cmd.exe",
84+
"${env:windir}\\System32\\cmd.exe"
85+
],
86+
"args": [
87+
// Please note that you need to change the directory to YOURS and translate the backslashes(`\` => `\\`).
88+
"/k","D:\\VisualStudio\\VS2022\\Community\\Common7\\Tools\\VsDevCmd.bat",
89+
"-startdir=none",
90+
"-arch=x64",
91+
"-host_arch=x64"
92+
// In you have not installed whole VisualStudio, only use
93+
// "D:\\VisualStudio\\VS2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat"
94+
// or some directory you installed is better.
95+
],
96+
"icon": "terminal-cmd"
97+
},
98+
"PowerShell for VS2022": {
99+
"source": "PowerShell",
100+
"args": [
101+
"-NoExit",
102+
"-Command",
103+
// Don't forget let `"""` into `\"` in module part during copy.
104+
"&{Import-Module \"D:\\VisualStudio\\VS2022\\Community\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll\"; Enter-VsDevShell e182031c -SkipAutomaticLocation -DevCmdArguments \"-arch=x64 -host_arch=x64\"}"
105+
],
106+
"icon": "terminal-powershell",
107+
"env": {}
108+
}
109+
}
84110
}
85111
```
112+
113+
> **How arguments come?**
114+
>
115+
> If you have Windows Terminal, after VS2022 installed, your Windows Terminal app should include `Developer Command Prompt for VS2022` and `Developer PowerShell for VS2022`.
116+
>
117+
> Next you just need to switch to "Configuration" and scroll down to "Profiles" and choose the one you prefer.
118+
>
119+
> After copy and paste, simply do like `~w()` sigil does in `args` part above, replacing the paths with your actual Visual Studio installation directory.

0 commit comments

Comments
 (0)