Skip to content

Support XDG_CONFIG_HOME for the argv.json file #162712

@lgarron

Description

@lgarron

There are many of us who find it bad practice that VSCode creates a ~/.vscode/ folder instead of following the common XDG base directory structure, respected by a wide variety of programs. This issue has come up regularly, without a good permanent solution:

I would like to propose the following new behaviour:

  1. If ~/.config/vscode/argv.json1 is present at launch in non-portable mode, then VSCode uses this as the path for argv.json.
  2. argv.json supports setting the following arguments, which the user can set to XDG-compatible paths if they like:
  • user-data-dir
  • extensions-dir

As far as I can tell, this would be sufficient to avoid creating a ~/.vscode/ folder. It also reuses the existing structure of VSCode to do this without introducing significant hacks, edge cases, or race conditions.

Part 1 seems reasonably feasible to me, given that argv.json is hardcoded in delightfully few places at the moment: https://github.com/microsoft/vscode/search?q=%22argv.json%22&type=code

Part 2 would essentially involve adding those arguments to SUPPORTED_ELECTRON_SWITCHES.

I'd be happy to submit a PR if this kind of approach is amenable to the maintainers.

Footnotes

  1. If a non-branded or non-Insiders build is launched, this would generalize to ~/.config/[prefix]code[suffix]/argv.json, per https://github.com/microsoft/vscode/issues/3884 . This is deterministic for any given installed build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalitygood first issueIssues identified as good for first-time contributorshelp wantedIssues identified as good community contribution opportunitieslinuxIssues with VS Code on Linuxworkbench-os-integrationNative OS integration issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions