microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.28k stars 28.57k forks source link

.vscode\cli\ ignores portable mode #184646

Open dreamflow opened 1 year ago

dreamflow commented 1 year ago

Does this issue occur when all extensions are disabled ? : Yes

Steps to Reproduce :

run vscode in portable mode as described here https://code.visualstudio.com/docs/editor/portable

in "%USERPROFILE%\.vscode\cli" ( = usually "C:\Users\%USERNAME%\" ) the folder ".vscode\cli\" is created by vscode , although vscode is in portable mode .

Expected Behaviour :

the folder ".vscode\cli\" should be created within the portable "data\"-folder , whose path is in the env var VSCODE_PORTABLE , when vscode is started in portable mode .

dreamflow commented 1 year ago

@connor4312 could you please add the label portable-mode to this issue .

dreamflow commented 1 year ago

i've checked the prior vscode versions down to 1.70 . it turned out , that this issue could be a "regression" , because versions up to 1.77.3 didn't have this issue , but all vscode versions since 1.78.0 have this issue .

in the versions 1.78.0 ... 1.78.2 the folder wrongly created outside of the portable "data\"-folder , was %USERPROFILE%\.vscode-cli since 1.79.0 , it is %USERPROFILE%\.vscode\cli

@connor4312 could you please change the label "feature-request" to "regression" for this issue .

connor4312 commented 1 year ago

This is not a regression. The CLI never supported portable mode, the default data directory just moved.

NorthboundTrain commented 11 months ago

This also occurs under Linux:

I am starting the editor session via the CLI itself, if that matters. My launch command includes the CLI argument --user-data-dir=<portable dir>/data, but the ~/.vscode/cli directory is still created (--user-data-dir normally has no effect in Portable mode, but if the CLI doesn't support Portable mode, I thought I'd give it a shot). However, setting the VSCODE_CLI_DATA_DIR environment variable does prevent ~/.vscode/cli from being created (although the cli directory is not then created anywhere, that I can tell).

a3n14uk5 commented 8 months ago

Hi. This is an issue with the behavior of code or code-tunnel. code enters portable-mode if there is a data folder directly under it. Then, how portable code is depends on how complete necessary files are in the data folder. For example, if there is a valid JSON file named argv.json, code will not try to create a file in ~/.vscode and will be more portable if there is a data/tmp/ folder. However, for the ~/.vscode/cli/ directory, this convention is broken and the directory will continue to be created even if data/cli/ is provided. The workaround is to provide --cli-data-dir or VSCODE_CLI_DATA_DIR dynamically.


nl8-gh commented 4 months ago

Curious: Is anyone actually working to get this fixed, or, even better, get things aligned with XDG recommendations - officially?