eclipse-theia / generator-theia-extension Goto Github PK
View Code? Open in Web Editor NEWA Yeoman generator for extensions to the Theia IDE
License: Other
A Yeoman generator for extensions to the Theia IDE
License: Other
It could be fun to try semantic releases: https://github.com/semantic-release/semantic-release
Transfer of the issue eclipse-theia/theia#5182
as highlighted in the coding guidlines. Affects at least "hello world" and "backend", others to be checked...
https://github.com/eclipse-theia/theia/wiki/Coding-Guidelines#property-injection
As mentioned in the discussion below, the instructions in the Readme on how to launch the examples are inconsistent. In the "how to run" sections it mentions the CLI command, in the "how to develop" it mentions the VSCode configs. I suggest to:
I'm a little confused as to why the docs describe the watch workflow in such a way where we need to launch the backends with vscode, we can alternatively also describe how to do so simply with the terminal.
I agree that it would make sense to at least also mention that the backend can be started from within VSCode via the launch config or with e.g.
cd browser-app; yarn start
. Do you want me to open a separate PR with a proposal?
If you'd like to and agree it adds value for extension developers then please feel free to open the PR :)
Originally posted by @vince-fugnitto in #82 (comment)
It would be useful to support the standalone generation of an extension meaning without he root level, the browser app and the electron app. This allows to create a new extension into an existing project.
PRs are welcomed. You have to add .browser_modules
here:
https://github.com/theia-ide/generator-theia-extension/blob/d6d81b47e78ad81d27c36ea8f91f0170def61335/templates/gitignore#L1
The proposal is to update the readme
to add additional information for all available templates.
The changes can look something like:
Template Option | Description | Documentation |
---|---|---|
hello-world |
Creates a simple extension which provides a command and menu item which displays a message | readme |
widget |
Creates the basis for a simple widget including a toggle command, alert message and button displaying a message | readme |
labelprovider |
Creates a simple extension which adds a custom label (with icon) for .my files | readme |
tree-editor |
Creates a tree editor extension | readme |
empty |
Creates a simple, minimal extension | readme |
backend |
Creates a backend communication extension | readme |
We should implement it by composing code yeoman generator.
Otherwise, running yarn
will hit a deadlock on Windows due to the parallel execution.
Update: copy the lerna.js
from here into the root of your extension (where you can find the actual extension with the example apps) and replace lerna
with node lerna.js
in your npm scripts.
Update2: make sure the lernaPath
points into lerna
inside the node_modules/.bin
I want to create a custom editor through the widget example, what should I do?
$ npm install -g yo generator-theia-extension
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
/root/.nvm/versions/node/v10.16.3/bin/yo -> /root/.nvm/versions/node/v10.16.3/lib/node_modules/yo/lib/cli.js
/root/.nvm/versions/node/v10.16.3/bin/yo-complete -> /root/.nvm/versions/node/v10.16.3/lib/node_modules/yo/lib/completion/index.js
> [email protected] postinstall /root/.nvm/versions/node/v10.16.3/lib/node_modules/generator-theia-extension/node_modules/spawn-sync
> node postinstall
internal/modules/cjs/loader.js:670
throw err;
^
Error: Cannot find module '/root/.nvm/versions/node/v10.16.3/lib/node_modules/generator-theia-extension/node_modules/spawn-sync/postinstall'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
at Function.Module._load (internal/modules/cjs/loader.js:591:27)
at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
at internal/main/run_main_module.js:21:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-09-06T01_24_57_543Z-debug.log
And the tail of this debug log,
$ tail /root/.npm/_logs/2019-09-06T01_24_57_543Z-debug.log
7080 verbose argv "/root/.nvm/versions/node/v10.16.3/bin/node" "/root/.nvm/versions/node/v10.16.3/bin/npm" "install" "-g" "yo" "generator-theia-extension"
7081 verbose node v10.16.3
7082 verbose npm v6.9.0
7083 error code ELIFECYCLE
7084 error errno 1
7085 error [email protected] postinstall: `node postinstall`
7085 error Exit status 1
7086 error Failed at the [email protected] postinstall script.
7086 error This is probably not a problem with npm. There is likely additional logging output above.
7087 verbose exit [ 1, true ]
I installed [email protected] and [email protected] but still no luck
npm install -g yo generator-theia-extension
OS and Theia version:
Diagnostics:
they should look similar to gitpod config file in Theia repo
PRs are welcomed. It should be changed here: https://github.com/theia-ide/generator-theia-extension/blob/d6d81b47e78ad81d27c36ea8f91f0170def61335/src/app/index.ts#L64
Instead of generating in the current folder
I'm currently working on a extension for Xtext syntax highlighting. :-)
The VS code extension works already and now thought I may try to create a Theia extension too. Unfortunately, the generator did not work for me.
Not sure what and why it fails. May be I'm doing something wrong.
denis@modula:~/VSCodeWorkspace/xtext-theia-extension$ yo theia-extension xtext-lang
XtextLang
create package.json
create lerna.json
identical .gitignore
create README.md
identical .vscode/launch.json
create xtext-lang/package.json
create xtext-lang/tsconfig.json
create xtext-lang/src/browser/xtext-lang-frontend-module.ts
create xtext-lang/src/browser/xtext-lang-contribution.ts
create browser-app/package.json
create electron-app/package.json
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn yarn ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Can you give me a hint, please?
Running yo theia-extension
currently fails with the following error:
ERROR in ../node_modules/vscode-languageclient/lib/client.js
Module not found: Error: Can't resolve 'vscode' in '/tmp/theia-extension/node_modules/vscode-languageclient/lib'
@ ../node_modules/vscode-languageclient/lib/client.js 10:17-34
@ ../node_modules/monaco-languageclient/lib/monaco-language-client.js
@ ../node_modules/monaco-languageclient/lib/index.js
@ ../node_modules/@theia/languages/lib/browser/language-client-factory.js
@ ../node_modules/@theia/languages/lib/browser/languages-frontend-module.js
@ ./src-gen/frontend/index.js
In order to reproduce
npm install -g yo generator-theia-extension
yo theia-extension my-extension
You will get a result as:
error TS18003: No inputs were found in config file '/workspace/my-extension/my-extension/tsconfig.json'. Specified 'include' paths were '["src"]' and 'exclude' paths were '["lib"]'.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm developing a new extension using [email protected]
. When generating the "hello" project, and running `yarn start in the browser-app directory, I noticed syntax highlighting does not work (tried on an HTML file). I also noticed I do not have access to the "Open URL" command (mini-browser).
Motivated by eclipse-theia/theia#4979
PR are welcomed. You have to add "private": true,
here:
https://github.com/theia-ide/generator-theia-extension/blob/9f49c84fbe90a7c74188882996f1f0ac12b81a16/templates/app-package.json#L1
There should be one config for each target.
We developed an extension generator that shows how to develop a tree based editor in Theia.
In particular the template shows:
After eclipse-theia/theia#1540 gets merged we should add --mode development
to build
& watch
npm scripts in the generated apps.
Description
There is a build failure when attempting to generate a LabelProvider extension using the generator. The build failure is likely due to a breaking change upstream:
src/browser/aaa-contribution.ts(22,5): error TS2416: Property 'getIcon' in type 'AaaLabelProviderContribution' is not assignable to the same property in base type 'LabelProviderContribution'.
Type '() => MaybePromise<string>' is not assignable to type '(element: object) => string | undefined'.
Type 'MaybePromise<string>' is not assignable to type 'string | undefined'.
Type 'Promise<string>' is not assignable to type 'string'.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
at Promise.all.then.arr (/Users/vincentfugnitto/Desktop/vince/node_modules/execa/index.js:236:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:71999) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:71999) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Steps to Reproduce
yarn
npm link
yo theia-extension
LabelProvider
option, and verify the buildin extension mode, some functionality in activity bar (on the very left) is missing like debugger, git, search. However, if we build the original theia repository, they are all there. Are we missing some dependency in package.json?
Should document details about the extension, e.g.:
How to try the feature in the running browser app
That stand alone extension have to manually added and how
When you start theia in the browser and you did not open the file view then the selection menu tries to open and only shows an empty overlay which is some pixels high.
If you open the files view and select some file then the selection menu shows all entries, most of which are disabled.
If you close the file view and reload the application in the browser the selection menu is empty again.
We should do it after 0.6.0 release.
Readme should cover typical tasks in the developer workflow similar to https://github.com/theia-ide/theia-extension-example#running-the-browser-example.
Description
The @theia/languages
extension dependency should be removed since it has been recently deprecated and will cause the examples not to run correctly.
The generator should tell the user, that it will add -extension
suffix so the user will not do that.
Currently it generates
'Hello World Extension Example'
currently it is not possible to skip prompting a user because of it
This would be useful to set up a new contribution, which is not covered by an existing template. The option to not create an example is actually already existing ("example:boolean"). However, the option is not correctly processed by most existing templates. As a consequence, if you set "example" to false, the templates will create the frontend module, but not the contribution, which leads to not compilable code. I suggest to remove the option "example" and provide a dedcaited empty template. I will push a PR.
Description
Add CI integration in order to run sanity check tests on the available generators.
The checks can be performed nightly, or simply be enabled per pull request.
Motivated by #46 (comment).
Would be nice to have a template on how to do communication with the backend. I will propose something...
If I run i.e. yo theia-extension hello-world
then no src
folder gets created.
This ends up in an build error.
...
hello-world: $ tsc
hello-world: error TS18003: No inputs were found in config file '/the/path/to/hello-world-extension/hello-world/tsconfig.json'. Specified 'include' paths were '["src"]' and 'exclude' paths were '["lib"]'.
...
Files created with given name parameter (where the 'hello-world' extension should be default):
$ yo theia-extension hello-world
HelloWorld
create package.json
create lerna.json
create .gitignore
create README.md
create .vscode/launch.json
create hello-world/package.json
create hello-world/tsconfig.json
create browser-app/package.json
create electron-app/package.json
vs. Files created without the name parameter and explicitly chosen extension kind:
$ yo theia-extension
? The extension's name hello-world
? The extension's type hello-world
HelloWorld
create package.json
create lerna.json
create .gitignore
create README.md
create .vscode/launch.json
create hello-world/package.json
create hello-world/tsconfig.json
create hello-world/src/browser/hello-world-frontend-module.ts
create hello-world/src/browser/hello-world-contribution.ts
create browser-app/package.json
create electron-app/package.json
Generator fails upon running this generator with default settings.
npm install -g yo generator-theia-extension
mkdir theia-hello-world-extension
cd theia-hello-world-extension
yo theia-extension hello-world-extension
hello-world-extension: $ tsc
hello-world-extension: error TS18003: No inputs were found in config file '/home/ubuntu/environment/theia-hello-world-extension/hello-world-extension/tsconfig.json'. Specified 'include' paths were '["src"]' and 'exclude' paths were '["lib"]'.
hello-world-extension: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
hello-world-extension: error Command failed with exit code 2.
hello-world-extension: npm ERR! code ELIFECYCLE
hello-world-extension: npm ERR! errno 2
hello-world-extension: npm ERR! [email protected] prepare: `yarn run clean && yarn run build`
hello-world-extension: npm ERR! Exit status 2
hello-world-extension: npm ERR!
hello-world-extension: npm ERR! Failed at the [email protected] prepare script.
hello-world-extension: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
hello-world-extension: npm ERR! A complete log of this run can be found in:
hello-world-extension: npm ERR! /home/ubuntu/.npm/_logs/2019-08-19T15_54_36_233Z-debug.log
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: npm run prepare
lerna ERR! warning package.json: No license field
lerna ERR! warning package.json: No license field
lerna ERR! error Command failed with exit code 2.
lerna ERR! npm ERR! code ELIFECYCLE
lerna ERR! npm ERR! errno 2
lerna ERR! npm ERR! [email protected] prepare: `yarn run clean && yarn run build`
lerna ERR! npm ERR! Exit status 2
lerna ERR! npm ERR!
lerna ERR! npm ERR! Failed at the [email protected] prepare script.
lerna ERR! npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
lerna ERR!
lerna ERR! npm ERR! A complete log of this run can be found in:
lerna ERR! npm ERR! /home/ubuntu/.npm/_logs/2019-08-19T15_54_36_233Z-debug.log
lerna ERR!
lerna ERR!
lerna ERR! > [email protected] prepare /home/ubuntu/environment/theia-hello-world-extension/hello-world-extension
lerna ERR! > yarn run clean && yarn run build
lerna ERR!
lerna ERR! yarn run v1.17.3
lerna ERR! $ rimraf lib
lerna ERR! Done in 0.17s.
lerna ERR! yarn run v1.17.3
lerna ERR! $ tsc
lerna ERR! error TS18003: No inputs were found in config file '/home/ubuntu/environment/theia-hello-world-extension/hello-world-extension/tsconfig.json'. Specified 'include' paths were '["src"]' and 'exclude' paths were '["lib"]'.
lerna ERR! info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR!
lerna ERR! at Promise.all.then.arr (/home/ubuntu/environment/theia-hello-world-extension/node_modules/execa/index.js:236:11)
(node:16576) UnhandledPromiseRejectionWarning: Error: Command failed: npm run prepare
warning package.json: No license field
warning package.json: No license field
error Command failed with exit code 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] prepare: `yarn run clean && yarn run build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2019-08-19T15_54_36_233Z-debug.log
[email protected] prepare /home/ubuntu/environment/theia-hello-world-extension/hello-world-extension
yarn run clean && yarn run build
yarn run v1.17.3
$ rimraf lib
Done in 0.17s.
yarn run v1.17.3
$ tsc
error TS18003: No inputs were found in config file '/home/ubuntu/environment/theia-hello-world-extension/hello-world-extension/tsconfig.json'. Specified 'include' paths were '["src"]' and 'exclude' paths were '["lib"]'.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
at Promise.all.then.arr (/home/ubuntu/environment/theia-hello-world-extension/node_modules/execa/index.js:236:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:16576) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:16576) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
`
This is confusing, the command should be named "say hello" (like the menu item).
I will provide a fix...
It should take into the account reflect-metadata modules.
The generated README should contain info on how to run it.
Description
The proposal is to move the repository under the eclipse-theia organization. Moving the repository can potentially increase visibility and also welcome additional contributions and contributors. One issue with moving might be re-licensing the repository.
Would anyone object to moving the repo?
Would be nice as another simple example on how to extend Theia, we will contribute the template
Otherwise 0.2.0
is published the first time.
... and ideally disable the action when no workspace is opened
With the introduction of the second template (widget), you cannot call yo theia-extension hello-world-extension anymore (without specifying the template to be used). This is however documented as the default call here: https://www.theia-ide.org/docs/authoring_extensions
Suggestion is to use the hello-world template as default if the user does not specify anything, I will provide this fix.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.