che icon indicating copy to clipboard operation
che copied to clipboard

A vsx that works fine on Gitpod and VS Code but does NOT on Che

Open erlansan opened this issue 6 years ago • 16 comments

Hello,

i'm currently running a minikube cluster with che server on it. My goal is to add a VS extension to it. I followed this tutorial on how to add a VS extension to a custom plug-in registry: https://www.eclipse.org/che/docs/che-7/building-and-running-a-custom-registry-image/#building-a-custom-devfile-registry_building-and-running-a-custom-registry-image I'm stuck at step 5. Running docker build -t my-devfile-registry gives me the following output: PS C:\repositories\che-plugin-registry> docker build -t che-plugin-registry
"docker build" requires exactly 1 argument. I've tried running .build.sh file from powershell, but it briefly opens a window and closes it, without any result. I've tried adding this folder in Plug-in view in Che Editor, but it didn't add anything new.

My question is, what am i missing?

erlansan avatar Jul 08 '20 11:07 erlansan

Hello @erlansan

you could use gist to host some files

create a meta.yaml on https://gist.githubusercontent.com/

and paste the content of what you need for you VS Code extension (basically the path to the vsix and an optional runtime container)

apiVersion: v2
publisher: erlansan
name: typescript
version: 1.0.0
type: VS Code extension
displayName: erlansan
title: erlansan
description: erlansan
icon: https://www.eclipse.org/che/images/logo-eclipseche.svg
repository: https://github.com/erlansan
category: Language
firstPublicationDate: '2020-07-08'
spec:
  containers:
    - image: "quay.io/fbenoit/che-typescript-plugin:latest"
      name: vscode-typescript
      memoryLimit: '512Mi'
  extensions:
    - https:/THE-LINK-TO-THE.vsix

and then create a devfile in your workspace

and add a new component (url of this gist)

components:
  -
    type: chePlugin
  ...
  ...
  -
    type: chePlugin
    reference: https://raw.githubusercontent.com/erlansan/........GIST_URL......./meta.yaml
    memoryLimit: 512Mi
...
  -
    type: chePlugin

benoitf avatar Jul 08 '20 11:07 benoitf

I tried it, seems not to have any effect on the number of plugins i have available. The second component seems to work completely fine. Part of my Devfile content:

...
components:
  - memoryLimit: 512Mi
    type: chePlugin
    reference: >-
      https://gist.githubusercontent.com/erlansan/c15872800c6c7366fa743d98c10d9274/raw/458c7f0ed8c8cc6db2bba86967353a424634c305/meta.yaml
    alias: debugVisualizer           this is my component that doesn't appear in plugin view
  - id: redhat/java11/latest        this component appears in plugin view as installed
    type: chePlugin
  - mountSources: true
    memoryLimit: 512Mi
    type: dockerimage
    volumes:
      - name: m2
        containerPath: /home/user/.m2
    image: 'quay.io/eclipse/che-java11-maven:7.15.0'
...

image

The VS extension i added doesn't appear in the list

erlansan avatar Jul 08 '20 13:07 erlansan

@tolusha even tho the workspace is being created after adding the VS extension to devfile, it doesn't seem to have any effect. I've tried redoing it many times, the Plugin View stays the same. Is there any other approach i can try? Is there a possibility to access the plugin registry i'm currently running, and adding my VS extension to it? I tried following this guide: https://github.com/redhat-developer/codeready-workspaces/blob/master/devdoc/building/build-vsix-extension.adoc , but all the links are broken.

erlansan avatar Jul 08 '20 15:07 erlansan

vsix link should be https://github.com/erlansan/debug_visualizer/raw/master/hediet.debug-visualizer-1.1.0.vsix

benoitf avatar Jul 08 '20 15:07 benoitf

@benoitf thank you for the link! It works now. I have the commands from this VS extension available in the IDE.

erlansan avatar Jul 08 '20 16:07 erlansan

closing the issue then 👍

benoitf avatar Jul 08 '20 16:07 benoitf

Hello again :D I would like to reopen the issue. I tested the extension, and it didn't work as expected. But then i tried running the same VS extension in gitpod, which has embedded Theia IDE. Gitpod has this nice feature, where you can drag and drop VSIX files into plugin view, and they will be installed right away. The problem now is, that the VS extension works differently in gitpod than in my Che server. I also tried running the same extension in VS Code itself, to know how it should've behaved. Here are the comparisons: Screenshot from VSC: image

Screenshot from GitPod: image You can see how GitPod has the same Debug View, but it doesn't read the values. The link to GitPod workspace.

Screenshot from local Che server: image As you can see, it's not the same as in GitPod. Whereas i would expect the same result from the same VS extension and same code snippets.

My Devfile components from Che server:

...
components:
  - memoryLimit: 512Mi
    type: chePlugin
    reference: >-  https://gist.githubusercontent.com/erlansan/4be0ef7b7177f79ce3a5205a9855c725/raw/a658bc27d56a026f72535769219eb8ff7f5f6dc1/meta.yaml
    alias: debugVisualizer
...

Content of .gitpod.yml from GitPod:

vscode:
  extensions:
    - [email protected]:e28CNc27zo2UDGVVCEGN0A==

My question is, how can i make my local installation of VS extension at least the same as in GitPod? Is there any way they are differently installed? Also, is there a possibility to export workspace from GitPod to my local Che server?

erlansan avatar Jul 10 '20 14:07 erlansan

I think there are at least 3 distinct issues here:

  1. we should make it easier to test a vsx (drag and drop, chectl to generate and publish a devfile) #17376
  2. adding a plugin to the registry should be an admin task, not a user task (as it is currently in the documentation) #17377
  3. @erlansan vs code extension doesn't work properly on Che Theia (this issue).

I have created 2 issues for the first 2 points. I am reopening this issue and setting a different title because that's not related to the registry.

l0rd avatar Jul 11 '20 02:07 l0rd

@l0rd thank you for reopening the issue and creating new ones. My main goal right now is to get this plugin to work. A possible solution to that is ofc adding new cool functionality to drag and drop vsix files into plugin view, but i'm kinda in a rush with this project :D It looks like it's somewhat working on gitpod, which means there must be a running instance of a Che workspace with installed VS extension on it. Is there a possibility to import that workspace from gitpod to my local server? For example through URL in a custom workspace menu in the dashboard?

erlansan avatar Jul 11 '20 02:07 erlansan

@erlansan maybe that's related to the fact that your extension needs Java locally and it's running in a container that only has typescript?

l0rd avatar Jul 11 '20 09:07 l0rd

@l0rd maybe, but it doesn't explain why the Debug View of the plugin differs in gitpod and my local Che server. I need to at least make it show the same as it shows in gitpod. In my local server, it's just a blank view, whereas in gitpod there are some visual elements as in VS code. I would say the way the extension is installed right now, something is not right. Because in gitpod it shows up properly in plugin view and the debug view itself shows something, but my local server doesn't show the extension in plugin view, and debug view is blank. The workspaces and the way i was testing it was completely the same. I don't think it's about missing java. On VSC, gitpod and Che i was running the same project the same way. Maybe there is a way to copy gitpods workspace with already installed extension, or maybe copy the way it's being installed from gitpod and replicate it on my local server?

erlansan avatar Jul 11 '20 13:07 erlansan

@erlansan on gitpod everything runs in one container that has the JDK, nodejs and other runtimes pre-installed (just in case). In Che instead your vsx runs in a container that the vsx author can customize. And your container currently has only nodejs. If you need more tools you need to change the image in the meta.yaml. On local VS Code instead your extension has access to whatever you have installed locally (your extension doesn't run in a container).

l0rd avatar Jul 11 '20 13:07 l0rd

@l0rd thanks for quick response! I'm running java maven/gradle workspace, so i thought it would mean that java is installed and available for the VS extension. I was thinking since i can run and debug java, the extension must have access to JDK too. After reading your response i have 2 questions in my mind:

  1. By changing the image in the meta.yaml, do you mean plugin registry or devfile registry meta.yaml file?
  2. Is there a way to see what is installed in gitpod, so that i can replicate that for my local Che server?

erlansan avatar Jul 11 '20 14:07 erlansan

By changing the image in the meta.yaml, do you mean plugin registry or devfile registry meta.yaml file?

The plugin meta.yaml

l0rd avatar Jul 13 '20 22:07 l0rd

Ping, any update here? Were you able to get it working @erlansan

ericwill avatar Sep 30 '20 20:09 ericwill

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.

che-bot avatar Apr 06 '21 11:04 che-bot