Using @eclipse-che/plugin gives error
See original GitHub issueSummary
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:
- Created 2 years ago
- Comments:12 (9 by maintainers)
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.
Issues go stale after
180
days of inactivity.lifecycle/stale
issues rot after an additional7
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.