Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Error on compiling example plugin - Cannot find name 'Comment' #19

Closed
arangatang opened this issue Jul 29, 2019 · 3 comments
Closed

Error on compiling example plugin - Cannot find name 'Comment' #19

arangatang opened this issue Jul 29, 2019 · 3 comments

Comments

@arangatang
Copy link

arangatang commented Jul 29, 2019

Hiya,
I get an error when running the plugin generator with all default values.
I.E just pressing enter after running yo @theia/plugin

Also see here for the spectrum thread:
https://spectrum.chat/theia/general/custom-debug-plugin~15e03363-5539-40e7-bc10-49b82dc880eb

I followed the instructions under:
https://www.theia-ide.org/doc/Authoring_Plugins.html

The error is the following:

$ tsc
node_modules/@theia/plugin/src/theia.d.ts:8157:19 - error TS2304: Cannot find name 'Comment'.

8157         comments: Comment[];
                       ~~~~~~~

node_modules/@theia/plugin/src/theia.d.ts:8312:80 - error TS2304: Cannot find name 'Comment'.

8312         createCommentThread(id: string, resource: Uri, range: Range, comments: Comment[]): CommentThread;
                                                                                    ~~~~~~~


Found 2 errors.

The entire output + commands are shown below:

User@ubuntu:~/plugin$ yo @theia/plugin

     _-----_     
    |       |    ╭──────────────────────────╮
    |--(o)--|    │   Welcome to the 'Theia  │
   `---------´   │    Plug-in' generator!   │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

? What is the plug-in's name? plugin
? What type of plug-in do you want? Backend plug-in, it will run on the server side.
? Please, choose a template: Hello World plug-in
License is not specified. You can do it via --license parameter.
   create plugin/package.json
   create plugin/.gitignore
   create plugin/README.md
   create plugin/tsconfig.json
   create plugin/tsfmt.json
   create plugin/src/plugin-backend.ts
Installing dependencies with yarn...
yarn install v1.17.3
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
success Saved lockfile.
$ yarn run clean && yarn run build
yarn run v1.17.3
$ rimraf lib
Done in 0.12s.
yarn run v1.17.3
$ yarn run format-code && yarn run compile && theia-plugin pack
$ tsfmt -r
$ tsc
node_modules/@theia/plugin/src/theia.d.ts(8157,19): error TS2304: Cannot find name 'Comment'.
node_modules/@theia/plugin/src/theia.d.ts(8312,80): error TS2304: Cannot find name 'Comment'.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

User@ubuntu:~/plugin/plugin$ yarn
yarn install v1.17.3
warning package.json: License should be a valid SPDX license expression
warning [email protected]: License should be a valid SPDX license expression
[1/5] Validating package.json...
warning [email protected]: License should be a valid SPDX license expression
warning [email protected]: The engine "theiaPlugin" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@theia/plugin-packager > [email protected]" has unmet peer dependency "glob@*".
[5/5] Building fresh packages...
success Saved lockfile.
$ yarn run clean && yarn run build
yarn run v1.17.3
warning package.json: License should be a valid SPDX license expression
warning [email protected]: The engine "theiaPlugin" appears to be invalid.
$ rimraf lib
Done in 0.20s.
yarn run v1.17.3
warning package.json: License should be a valid SPDX license expression
warning [email protected]: The engine "theiaPlugin" appears to be invalid.
$ yarn run format-code && yarn run compile && theia-plugin pack
warning package.json: License should be a valid SPDX license expression
warning [email protected]: The engine "theiaPlugin" appears to be invalid.
$ tsfmt -r
warning package.json: License should be a valid SPDX license expression
warning [email protected]: The engine "theiaPlugin" appears to be invalid.
$ tsc
node_modules/@theia/plugin/src/theia.d.ts:8157:19 - error TS2304: Cannot find name 'Comment'.

8157         comments: Comment[];
                       ~~~~~~~

node_modules/@theia/plugin/src/theia.d.ts:8312:80 - error TS2304: Cannot find name 'Comment'.

8312         createCommentThread(id: string, resource: Uri, range: Range, comments: Comment[]): CommentThread;
                                                                                    ~~~~~~~


Found 2 errors.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
@vince-fugnitto
Copy link
Member

vince-fugnitto commented Jul 29, 2019

For the meantime, you can simply add the add the option skipLibCheck in the tsconfig.json.
The fix should be upstream I believe.

@arangatang
Copy link
Author

arangatang commented Jul 30, 2019

Great, thank you that solved it!

@akurinnoy
Copy link

akurinnoy commented Jul 30, 2019

@arangatang @vince-fugnitto Plugin API lacks some interfaces which causes this problem. PR with fix: eclipse-theia/theia#5816 eclipse-theia/theia#5818

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants