che
che copied to clipboard
Document how to add VSCode extensions
Summary
In che 7.41.2 I could add custom VSCode extensions to a workspace by adding a component of type chePlugin to the devfile. Now that the way workspaces are created has completely changed, that doesn't work anymore (I tried having it auto-convert old devfiles to the new schema, but it just removed the plugins). I can't find any documentation on how to do it in recent versions. I have read some third-party guides like https://che.eclipseprojects.io/2021/06/23/@florent.benoit-devfile-v2-and-ide-plug-ins.html but everything they suggest seems to just have no effect.
Relevant information
Che version I'm using: 7.49.0 Environment: Fedora 36 in QEMU, Kind cluster (local dev environment)
Hi @yujiri8 -- you are right that devfile v2 removed ChePlugins from the spec. This was done to avoid confusion (as not all editors support all plugins). The current documentation for adding a plugin to your workspace is here: https://www.eclipse.org/che/docs/stable/end-user-guide/adding-a-vscode-extension/
See also this issue, which covers a similar case: https://github.com/eclipse/che/issues/21565
That is the workflow suggested in the blog post I read, which I tried and couldn't get to have any effect. My testing repo is at https://github.com/yujiri8/chetest (Though I did not find that page in the official docs, because I expected it to be under administrator guide)
I looked at the che-samples organization and those projects don't seem to be doing that. The java lombok project, for example, seems to have some java language support enabled when I create a workspace using it from the che dashboard, but the repository for it contains no such file .vscode/extensions.json
: https://github.com/che-samples/lombok-project-sample
So how does it actually work? How do the examples do it?
Also, our actual use case involves creating workspaces through the che API, not by entering a git URL in the dashboard. The documentation page seems to only apply to entering a git URL. How would I do it without a git repository?
So how does it actually work? How do the examples do it?
@yujiri8 we use branch devfilev2
in the che-samples. I agree that's confusing and we need to clean it up.
Also, our actual use case involves creating workspaces through the che API, not by entering a git URL in the dashboard. The documentation page seems to only apply to entering a git URL. How would I do it without a git repository?
You can use the Kubernetes API to create workspaces. Here is a video where I explain that and this is a repo with the source code for that demo. Note that we are improving that flow with these PRs (1 and 2).
I tried for several more days and was completely unable to replicate a workspace that loads extensions using the .vscode/extensions.json
, even usign the devfilev2 branch as you suggested. Eventually I tried putting in the git URL for one of the samples and found that didn't load the extensions either! It works when clicking the buttons to create the samples, but not when entering their git URLs. By watching devtools, I found the che-theia.eclipse.org/vscode-extensions
section in the attributes
section, which contains URLs to .vsix
files, and saw that these are what actually makes it work. I can get a workspace to load extensions without a .vscode/extensions.json
file as long as these attributes are present, and cannot get a workspace to load them without these attributes even if .vscode/extensions.json
is present.
Perhaps there is a way I missed to get it working using the .vscode/extensions.json
file, but regardless, I strongly recommend documenting the usage of the che-theia.eclipse.org/vscode-extensions
attributes.
Issues go stale after 180
days of inactivity. lifecycle/stale
issues rot after an additional 7
days of inactivity and eventually close.
Mark the issue as fresh with /remove-lifecycle stale
in a new comment.
If this issue is safe to close now please do so.
Moderators: Add lifecycle/frozen
label to avoid stale mode.