question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using @eclipse-che/plugin gives error

See original GitHub issue

Summary

I am trying to read out the devfile in a custom theia editor, which i want to use in a Che workspace. I am following these instuctions: https://www.eclipse.org/che/docs/che-7/contributor-guide/che-theia-plug-in-api/. If i understand it correctly this should work with the @eclipse-che/plugin package. However when i create a theia plugin (or vscode extension) consuming this package and use await che.workspace.getCurrentWorkspace(); in the activate() function, the plugin cannot be build. I was able to workaround the build failure, but then the same error happens when the plugin is activated:

root ERROR [hosted-plugin: 292] Activating extension 'che-extension' failed: Error: Cannot find module '@eclipse-che/plugin'
Require stack:
- /tmp/theia-unpacked/che-extension.theia/lib/che-extension-backend.js
- /custom-theia/client/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host-rpc.js
- /custom-theia/client/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Function.module._load (/custom-theia/client/node_modules/@theia/plugin-ext-vscode/lib/node/plugin-vscode-init.js:67:33)
    at Function.module._load (/custom-theia/client/node_modules/@theia/plugin-ext/lib/hosted/node/scanners/backend-init-theia.js:43:33)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/tmp/theia-unpacked/che-extension.theia/lib/che-extension-backend.js:45:11)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/tmp/theia-unpacked/che-extension.theia/lib/che-extension-backend.js',
    '/custom-theia/client/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host-rpc.js',
    '/custom-theia/client/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host.js'
  ]
}

Is there something i am missing with the @eclipse-che/plugin package? Is it only usable inside of Che-Theia or does it have any other constraints? Thanks in advance.

UPDATE: The problem above seems to not occur using the following theia plugin: https://github.com/sgraband/che-plugin-test. However, the plugin can still not be activated due to ‘che’ not being define: Activating extension '*' failed: che is not defined

Relevant information

I also tried it with this code:

const eclipseCheExtPlugin = vscode.extensions.getExtension('@eclipse-che.ext-plugin');
if (eclipseCheExtPlugin) {
  // grab user
  const user = await eclipseCheExtPlugin.exports.user.getCurrentUser();
 vscode.window.showInformationMessage(`Eclipse Che user information: id ${user.id} with name ${user.name}`);
} else {
  vscode.window.showWarningMessage('Not running inside Eclipse Che, not displaying any user information');
}

But this results in Not running inside Eclipse Che, not displaying any user information, when running the editor in Che.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
benoitfcommented, Aug 12, 2021

also the API exposed by our @eclipse-che/plugin is tied to the version of underlying Che (like our Devfile model) but also to the underlying version of Theia. So it means that if a ‘custom Theia’ would use the implementation of our Che-Theia, it would have to stick to the same “Theia+Che version” which is a very high constraint and it’s also due to the Extension Model of Theia that is mostly failing when not using the same Theia dependency.

That said, this is why to not having to re-implement some logic in all editors that we moved the clone operation at an earlier step in the DevWorkspace. ( https://github.com/eclipse/che/issues/15973 ) And that IDE plug-ins are not part of the Devfile v2 but are part of the project source code.

And we also want to have commands of the devfile being exposed by shell aliases as well so in the end you can easily plug other editors without having to handle clone or commands of the devfile, etc but still interact with your workspace definition.

0reactions
che-botcommented, Feb 12, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[che-dev] Che failed with Exception: "Server wsagent/http not ...
I have some question to the local Eclipse Che development: I implemented a che plugin which has several dependencies. The Maven Build works...
Read more >
Kubernetes Plugin for Eclipse Che - Medium
In Eclipse Che 7, we use Eclipse Theia as the default code editor. Theia provides a very similar user experience to VSCode. At...
Read more >
Getting 404 error on Eclipse che-dashboard hosted on GKE
The cause of it is that dashboard deployment is not reachable, probably due Ingress misconfiguration. Also I have changed the path in ...
Read more >
eclipse/che - Gitter
I have create an issue here with the details: eclipse/che#2247 ... I'm getting this error after I was trying to run using superdev...
Read more >
Chapter 5. Customizing developer environments
5.1.2. Che-Theia plug-in concept in detail. Red Hat CodeReady Workspaces provides a default web IDE for workspaces: Che-Theia. It is based on Eclipse...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found