Repository: vscode
Issue: Revisit VS Code folder structure for app data, settings, extensions
Labels: feature-request,debt,workbench-os-integration

Config is stored in `~/.config/Code[ - <quality>]/User`. To match platform conventions (lowercase and hyphens for everything) as well as to keep consistency with the cli `code[-<quality>]` I propose we change the settings directory one of:
- `~/.config/code[-<quality>]/user`
- `~/.vscode[-<quality>]` (see https://github.com/Microsoft/vscode/issues/3883)
- `~/.code[-<quality>]` (to prevent using 'vs' showing up in the OSS build as it is now)

If we moved this it would probably require some discovery/migration on first launch of a newer version.

---

The below is a living document.

## Proposed folder structure

Notes:

- I don't think we should be encouraging the use of admin rights within vscode, instead a permissions elevation dialog would probably be better than allowing a specific place for root user data #5561
- I want to clean up the whole `code` vs `vscode` thing in this change; only official builds should carry the visual studio branding, that should carry over to the config directories consistently as well.
- The CLI args `--user-data-dir` and `--extensions-dir` will need to be adjusted for this, something like `--config-dir` and `--cache-dir` would probably be better.

### Windows

**Old**

```
Settings:                %APPDATA%\Code[ - Variant]\User\settings.json
Keybindings:             %APPDATA%\Code[ - Variant]\User\keybindings.json
Snippets:                %APPDATA%\Code[ - Variant]\User\snippets\
Workspace storage:       %APPDATA%\Code[ - Variant]\User\workspaceStorage\
Chromium user data:      %APPDATA%\Code[ - Variant]\
Extensions:              %USERPROFILE%\.vscode[-variant]\extensions\
```

**New**

```
Settings:                %APPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\settings.json
Keybindings:             %APPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\keybindings.json
Snippets:                %APPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\snippets\
Workspace storage:       %LOCALAPPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\workspaceStorage\
Chromium user data:      %LOCALAPPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\userdata\
Extensions:              %LOCALAPPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\extensions\
```

Notes:

- Note that `%APPDATA%` is roaming and `%LOCALAPPDATA%` is local, meaning extensions ***will not*** be carried across multiple machines until a solution is devised for #15442. An extension manifest, eg. `%APPDATA%\Microsoft\[Visual Studio ]Code[ - Variant]\extensions.json` which automatically installs extensions is my thinking of solving this problem.

### Linux

**Old**

```
Settings:                $HOME/.config/Code[ - Variant]/User/settings.json
Keybindings:             $HOME/.config/Code[ - Variant]/User/keybindings.json
Snippets:                $HOME/.config/Code[ - Variant]/User/snippets/
Workspace storage:       $HOME/.config/Code[ - Variant]/User/workspaceStorage/
Chromium user data:      $HOME/.config/Code[ - Variant]/
Extensions:              $HOME/.vscode[-variant]/extensions/ (not moving)
```

**New**


```
Settings:                $XDG_CONFIG_HOME/[vs]code[-variant]/settings.json
Keybindings:             $XDG_CONFIG_HOME/[vs]code[-variant]/keybindings.json
Snippets:                $XDG_CONFIG_HOME/[vs]code[-variant]/snippets/
Workspace storage:       $XDG_CACHE_HOME/[vs]code[-variant]/workspaceStorage/
Chromium user data:      $XDG_CACHE_HOME/[vs]code[-variant]/userdata/
Extensions:              $XDG_CACHE_HOME/[vs]code[-variant]/extensions/
```

Notes:

- Thanks to @ollie27 and others for calling out the [XDG Base Directory Specification](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html), see that document for fallbacks to the environment variables.
- `$XDG_CACHE_HOME` would be best for extensions provided there is an extensions manifest in `$XDG_CONFIG_HOME` #15442.
- Maybe extensions should live in `$XDG_DATA_HOME`?

### Mac

**Old**

```
Settings:                $HOME/Library/Application Support/Code[ - Variant]/User/settings.json
Keybindings:             $HOME/Library/Application Support/Code[ - Variant]/User/keybindings.json
Snippets:                $HOME/Library/Application Support/Code[ - Variant]/User/snippets/
Workspace storage:       $HOME/Library/Application Support/Code[ - Variant]/User/workspaceStorage/
Chromium user data:      $HOME/Library/Application Support/Code[ - Variant]/
Extensions:              $HOME/.vscode[-variant]/extensions/ (not moving)
```

**New**

```
Settings:                $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/settings.json
Keybindings:             $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/keybindings.json
Snippets:                $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/snippets/
Workspace storage:       $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/workspaceStorage/
Chromium user data:      $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/userdata/
Extensions:              $HOME/Library/Application Support/[Visual Studio ]Code[ - Variant]/extensions/
```

Notes:

- Is there a similar standard for dividing cache and config files on Mac? http://stackoverflow.com/a/5084892/1156119