Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Can't run the Language Server #6

Closed
pr1metine opened this issue May 16, 2020 · 10 comments
Closed

[BUG] Can't run the Language Server #6

pr1metine opened this issue May 16, 2020 · 10 comments

Comments

@pr1metine
Copy link

It looks like I am unable to get your server up and running @SyamSundarKirubakaran 😢 .

image
image

I tried Windows, WSL and Ubuntu 20.04 via Hyper-V with no success. Could you please confirm that your server is working as intended?

@pr1metine
Copy link
Author

pr1metine commented May 16, 2020

image

A screenshot of WSL for good measures.

Btw, I am running nodejs 12.16.3 and either Oracle JDK 8u202, 8u251 or OpenJDK 8 on all of my machines.

@SyamSundarKirubakaran
Copy link
Contributor

Hey @pr1metine The Language Server is build using shell commands for run-time code intelli-sense I'm pretty sure running in windows will not work. Not tried it on Ubuntu VM but can you try re-running the build scripts with sudo after clearing the project node_modules both in parent and it's child directories.

@pr1metine
Copy link
Author

Hello @SyamSundarKirubakaran ,
yeah you are right about Windows. I merely ran npm i and did my checks. That said, I attempted to run initserver.sh and reinitserver.sh with root privileges on WSL and the Ubuntu VM. Still I have not been successful and the same errors can be seen as in the screenshots. Note that the following output is made with WSL 2.

$ sudo -s
# java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
# echo $CLASSPATH
/opt/processing-3.5.4/core/library/core.jar
# uname -a
Linux Vierzehnhundert 4.19.84-microsoft-standard #1 SMP Wed Nov 13 11:44:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

When I try running reinitserver.sh (for full output see this gist):

# sh ./reinitserver.sh
Performing Server Cleanup...
rm: cannot remove './node_modules': No such file or directory
rm: cannot remove './node_modules': No such file or directory
Server Cleanup successful.!
Installing required node modules...
npm WARN lifecycle [email protected]~postinstall: cannot run in wd [email protected] cd client && npm install && cd ../server && npm install && cd .. (wd=/home/pr1metine/projects/LS4P)
added 42 packages from 49 contributors and audited 42 packages in 1.427s
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
Installation successful.!
[...]

When executing npm i in server/ and checking the error log (see gist):

[...]
592 silly install [email protected]
593 info lifecycle [email protected]~install: [email protected]
594 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle false
595 verbose lifecycle [email protected]~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pr1metine/projects/LS4P/server/node_modules/java/node_modules/.bin:/home/pr1metine/projects/LS4P/server/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
596 verbose lifecycle [email protected]~install: CWD: /home/pr1metine/projects/LS4P/server/node_modules/java
597 silly lifecycle [email protected]~install: Args: [ '-c', 'node-gyp rebuild' ]
598 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
599 info lifecycle [email protected]~install: Failed to exec install script
600 timing action:install Completed in 1559ms
601 verbose unlock done using /home/pr1metine/.npm/_locks/staging-5c826cc467e78338.lock for /home/pr1metine/projects/LS4P/server/node_modules/.staging
602 timing stage:rollbackFailedOptional Completed in 159ms
603 timing stage:runTopLevelLifecycles Completed in 2675ms
604 silly saveTree [email protected]
604 silly saveTree ├─┬ [email protected]
604 silly saveTree │ └─┬ [email protected]
604 silly saveTree │   └── [email protected]
604 silly saveTree ├─┬ [email protected]
604 silly saveTree │ ├─┬ [email protected]
604 silly saveTree │ │ └── [email protected]
604 silly saveTree │ ├─┬ [email protected]
604 silly saveTree │ │ ├── [email protected]
604 silly saveTree │ │ └── [email protected]
604 silly saveTree │ ├─┬ [email protected]
604 silly saveTree │ │ ├── [email protected]
604 silly saveTree │ │ ├─┬ [email protected]
604 silly saveTree │ │ │ ├─┬ [email protected]
604 silly saveTree │ │ │ │ └── [email protected]
604 silly saveTree │ │ │ └── [email protected]
604 silly saveTree │ │ ├── [email protected]
604 silly saveTree │ │ ├─┬ [email protected]
604 silly saveTree │ │ │ └─┬ [email protected]
604 silly saveTree │ │ │   ├── [email protected]
604 silly saveTree │ │ │   └── [email protected]
604 silly saveTree │ │ ├── [email protected]
604 silly saveTree │ │ └── [email protected]
604 silly saveTree │ ├── [email protected]
604 silly saveTree │ └── [email protected]
604 silly saveTree └─┬ [email protected]
604 silly saveTree   ├─┬ [email protected]
604 silly saveTree   │ ├── [email protected]
604 silly saveTree   │ └── [email protected]
604 silly saveTree   └── [email protected]
605 verbose stack Error: [email protected] install: `node-gyp rebuild`
605 verbose stack Exit status 1
605 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
605 verbose stack     at EventEmitter.emit (events.js:310:20)
605 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
605 verbose stack     at ChildProcess.emit (events.js:310:20)
605 verbose stack     at maybeClose (internal/child_process.js:1021:16)
605 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
606 verbose pkgid [email protected]
607 verbose cwd /home/pr1metine/projects/LS4P/server
608 verbose Linux 4.19.84-microsoft-standard
609 verbose argv "/usr/bin/node" "/usr/bin/npm" "i"
610 verbose node v12.16.3
611 verbose npm  v6.14.4
612 error code ELIFECYCLE
613 error errno 1
614 error [email protected] install: `node-gyp rebuild`
614 error Exit status 1
615 error Failed at the [email protected] install script.
615 error This is probably not a problem with npm. There is likely additional logging output above.
616 verbose exit [ 1, true ]

Maybe there is something wrong with the Java npm package or with my Java configuration in general. Could you walkthrough the whole process of setting up the server? Could you also state all prerequisites and dependencies?

@pr1metine
Copy link
Author

Open LS4P in VSCode and perform Terminal -> Run Build Task... from the Menu.

Running this results in the following output:

[11:11:02 AM] Starting compilation in watch mode...

client/src/extension.ts:2:25 - error TS2307: Cannot find module 'vscode'.

2 import * as vscode from 'vscode';
                          ~~~~~~~~

client/src/extension.ts:10:8 - error TS2307: Cannot find module 'vscode-languageclient'.

10 } from 'vscode-languageclient';
          ~~~~~~~~~~~~~~~~~~~~~~~

client/src/extension.ts:71:31 - error TS2304: Cannot find name 'Thenable'.

71 export function deactivate(): Thenable<void> | undefined {
                                 ~~~~~~~~

server/src/hover.ts:1:22 - error TS2307: Cannot find module 'vscode-languageserver'.

1 import * as lsp from 'vscode-languageserver'
                       ~~~~~~~~~~~~~~~~~~~~~~~

server/src/hover.ts:4:37 - error TS2307: Cannot find module 'vscode-languageserver'.

4 import { Hover, MarkedString } from 'vscode-languageserver';
                                      ~~~~~~~~~~~~~~~~~~~~~~~

server/src/definition.ts:7:28 - error TS2307: Cannot find module 'vscode-languageserver'.

7 import { Definition } from 'vscode-languageserver'
                             ~~~~~~~~~~~~~~~~~~~~~~~

server/src/lens.ts:1:42 - error TS2307: Cannot find module 'vscode-languageserver'.

1 import { CodeLens, CodeLensParams } from 'vscode-languageserver'
                                           ~~~~~~~~~~~~~~~~~~~~~~~

server/src/references.ts:1:43 - error TS2307: Cannot find module 'vscode-languageserver'.

1 import { Location, ReferenceParams } from 'vscode-languageserver'
                                            ~~~~~~~~~~~~~~~~~~~~~~~

server/src/server.ts:18:8 - error TS2307: Cannot find module 'vscode-languageserver'.

18 } from 'vscode-languageserver';
          ~~~~~~~~~~~~~~~~~~~~~~~

server/src/server.ts:76:52 - error TS7006: Parameter '_event' implicitly has an 'any' type.

76      connection.workspace.onDidChangeWorkspaceFolders(_event => {
                                                         ~~~~~~

server/src/server.ts:89:35 - error TS2304: Cannot find name 'Thenable'.

89 let documentSettings: Map<string, Thenable<ExampleSettings>> = new Map();
                                     ~~~~~~~~

server/src/server.ts:91:37 - error TS7006: Parameter 'change' implicitly has an 'any' type.

91 connection.onDidChangeConfiguration(change => {
                                       ~~~~~~

server/src/server.ts:104:56 - error TS2304: Cannot find name 'Thenable'.

104 export function getDocumentSettings(resource: string): Thenable<ExampleSettings> {
                                                           ~~~~~~~~

server/src/server.ts:119:21 - error TS7006: Parameter 'event' implicitly has an 'any' type.

119 documents.onDidOpen(event => {
                        ~~~~~

server/src/server.ts:126:22 - error TS7006: Parameter 'e' implicitly has an 'any' type.

126 documents.onDidClose(e => {
                         ~

server/src/server.ts:132:30 - error TS7006: Parameter 'change' implicitly has an 'any' type.

132 documents.onDidChangeContent(change => {
                                 ~~~~~~

server/src/server.ts:142:36 - error TS7006: Parameter '_change' implicitly has an 'any' type.

142 connection.onDidChangeWatchedFiles(_change => {
                                       ~~~~~~~

server/src/diagnostics.ts:5:8 - error TS2307: Cannot find module 'vscode-languageserver'.

5 } from 'vscode-languageserver';
         ~~~~~~~~~~~~~~~~~~~~~~~

server/src/parser.ts:4:30 - error TS2307: Cannot find module 'vscode-languageserver'.

4 import { TextDocument } from 'vscode-languageserver';
                               ~~~~~~~~~~~~~~~~~~~~~~~

server/src/preprocessing.ts:1:22 - error TS2307: Cannot find module 'vscode-languageserver'.

1 import * as lsp from 'vscode-languageserver'
                       ~~~~~~~~~~~~~~~~~~~~~~~

server/src/completion.ts:1:22 - error TS2307: Cannot find module 'vscode-languageserver'.

1 import * as lsp from 'vscode-languageserver';
                       ~~~~~~~~~~~~~~~~~~~~~~~

server/src/completion.ts:2:68 - error TS2307: Cannot find module 'vscode-languageserver'.

2 import { CompletionItemKind, CompletionParams, TextDocument } from 'vscode-languageserver';
                                                                     ~~~~~~~~~~~~~~~~~~~~~~~

[11:11:05 AM] Found 22 errors. Watching for file changes.

@SyamSundarKirubakaran
Copy link
Contributor

I'll give it a spin in my end and I'll let you know if it fails on my end as well.

@pr1metine
Copy link
Author

So? Did you succeed, @SyamSundarKirubakaran ?

@SyamSundarKirubakaran
Copy link
Contributor

Nope, definitely failing. I encountered the same issue with java npm package, in addition the vscode package (which is a main part of this project) is been deprecated, and migrated to vscode-test with it's own @types, on performing migration multiple dependent modules are throwing exceptions. Seems like I'll have to refactor/restructure a good amount of code. It's gonna take a while.

In the meantime, If you're really into language servers. I'll suggest you look into https://github.com/microsoft/vscode-extension-samples/tree/master/lsp-sample

Screenshot 2020-05-31 at 9 24 51 AM

@pr1metine
Copy link
Author

Godspeed, SyamSundarKirubakaran. Would you mind if I implemented the server with LSP4J?

@SyamSundarKirubakaran
Copy link
Contributor

SyamSundarKirubakaran commented May 31, 2020

Sure. I remember looking into LSP4J a year earlier but since I was about to build a Language Server for an Upcoming IDE for Processing which will probably be written in Electron JS. I went with the JS side of implementation. You can try it out with LSP4J as well.!

@SyamSundarKirubakaran
Copy link
Contributor

Should be working now.! Just do a clean and rebuild.!

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

No branches or pull requests

2 participants