[ExtensionDev] Expose API to get at file system locations
Some extension relay on hard coded paths that are not exposed by vscode. See for example code-sittings-sync. Those extension are broken in the insiders version. I see t two possible ways:
- Just expose all paths used by vscode to extensions. Otherwise they will hard code them. No more security, just more messy code.
- Expose if the extension is used by the insider version. There might be a way, but I have not found it yet. I thought about getting the version and check if it ends with
-insiders, but I have not found a way to get this information either.
Interesting... the insider version should be considered as a separate product, with its own user settings and extensions folders. This enables a clean side-by-side install. Therefore, the code-sittings-sync extension is product specific, depending on whether it is installed in the insiders or the stable product it should sync the corresponding product settings.
An extension gets its path passed in the ExtensionContext of the activate call. From the extension path you can derive in which product the extension is installed.
/.vscode-insiders/extensions/ or .vscode/extensions/.
Having said this a workaround, an extension should not have to do this path math and we exposing API to avoid this.
To recap, the paths we should expose
- [ ] extensions home folder, like
/Users/jrieken/.vscode-oss-dev/extensions - [ ] user config folder, like
/Users/jrieken/Library/Application Support/code-oss-dev/User
I am unsure if we should also expose the individual files inside that folder like settings.json, keybindings.json cos that list isn't finite.
@alefragnani for the bookmark extension I believe you need the user config folder. is that right? @SrTobi I am unsure if you only looking at sync'ing the user-level settings.json or also at others, like our keybindings.json and a potential future bookmarks.json etc
@jrieken exactly... thanks 👍
FYI https://github.com/Microsoft/vscode/pull/5570 is moving the user data directory to be a sibling of the extensions dir.
@Tyriar so should we expose the parent folder of those two directories?
@jrieken potentially... Post #5570, it might be better to move snippets, settings.json and keybindings.json to the parent directory so it stays away from Chrome's config. Do you know if there's any reason it's in user data as opposed to sitting next to extensions?
no clue... @joaomoreno or @bpasero will know
Historic reasons, we only had extensions folder a lot later.
Is it worth simplifying the structure further as part of #5570?
.vscode/settings.json
.vscode/keybindings.json
.vscode/snippets/
.vscode/extensions/
.vscode/userdata/
.vscode/rootuserdata/
Moving to June considering those potential upcoming changes
I like that very much.
@joaomoreno @Tyriar where are we with this and what's the plan?
The pull is quite stale and probably needs to be redone, there is also the complication of Windows directory changing as well #7035. Just a matter of prioritizing it against the other stuff in my backlog (mainly terminal bugs and linux packaging improvements).
@jrieken I'd like #7035 to be figured out before moving on this again. We don't really want to be migrating settings around multiple times if we can prevent it. It sounds like #7035 would need an extensions manifest to correctly support roaming on Windows.
Considering that settings.json and keybindings.json would probably best be situated at the root directory, not in Chromium's user data, how about we make an API to get at the User directory for now, which will eventually become the root?
<root_settings>/settings.json
<root_settings>/keybindings.json
<root_settings>/snippets/
<root_settings>/extensions/
<root_settings>/userdata/
<root_settings>/rootuserdata/
Sorry, again we didn't get to this... Tho we added a storagePath property for those extension that want to store state that doesn't fit into mementos but needs files/folders
Just wanted to check in on this. I assume this is also being pushed out past August like https://github.com/Microsoft/vscode/issues/3884
yeah - I am handcuffed as long as the underlying api/data isn't ready
@jrieken it should be fine to expose the User directory now, that will be the root config directory eventually after #3884. settings.json and keybindings.json will still be located there.
Any movement on this item? I'm after a way to reliably locate the snippets folder.