Reputation: 71
I am currently developing some custom VSCode extensions and would like to have separate optional extensions that build on a core extension. Currently it is a bit of a hassle to develop these congruently and I am currently aware of the following options:
1) Develop the extensions separately with separate debug instances
The downside here is that until the extensions is published or moved to your ~/.vscode/extensions folder the two extensions have no knowledge of the development versions of each other, making the debugging and rapid additions quite difficult.
2) Move extensions into ~/.vscode/extensions folder
The downside with this is that there is constant window reloading, sometimes it can be tricky to know when the main process has fully loaded the updated version and it has definitely been less convenient than the experience when developing one extension
3) Merge the two extensions into one extension
This makes debugging and rapid feature builds easier, but goes against some of the original modularization i was hoping for, so i haven't switch to this as of yet.
My question is, is there a better way people have found to accomplish this apart from the above 3 options i'm aware of? I've combed quite a bit through google, forums, and the vscode docs looking for options or other people hitting the same situation but haven't found anything as of yet.
From the VSCode docs, it appears that --extensionDevelopmentPath
"might" support multiple paths somehow, but i have yet to find anything conclusive or with examples of that to get it to work.
Upvotes: 7
Views: 1049
Reputation: 21
One method that I have used is to pull in the 'core' extension in as a submodule into a subdirectory, for example, .dependencies
. Remember to npm install
the 'core' extension from within its directory.
Then I would adjust your package.json
on the working extension to use the following scripts:
"scripts": {
...truncated for brevity...
"compile:core": "tsc -p .dependencies/{dep-folder}"
"compile:me": "tsc -p ./"
"compile": "npm run compile:core && npm run compile:me"
...truncated for brevity...
}
Finally, add the following to your launch.json
which will override VSCode's default extension folder to your .dependencies folder.
"args": [
"--extensions-dir=${workspaceFolder}/.dependencies"
"--extensionDevelopmentPath=${workspaceFolder}"
]
Upvotes: 2