jolie / vscode-jolie

Language support for Jolie in Visual Studio Code
MIT License
3 stars 6 forks source link

Language Server Requires npx #19

Open Niels-Erik opened 1 month ago

Niels-Erik commented 1 month ago

It seemed like the language server wasn't working while working in vs code outside of a dev container. However I found that it needs npx to run:

Activating Jolie Language Server
starting "cmd.exe /C npx --package=@jolie/languageserver@^1.0.0 joliels 9743"
'npx' is not recognized as an internal or external command,
operable program or batch file.

I would've assumed it gave an error that the server didn't start, and that npx was required.

kicito commented 1 month ago

Thank you for reporting, the new version(2.0) should include a more meaningful log/message on the editor.

Niels-Erik commented 4 weeks ago

I installed npm/npx and got other errors, though I think it's because the language server does not work on windows. I get the following output:

Activating Jolie Language Server
starting "cmd.exe /C npx --package=@jolie/languageserver@^1.0.0 joliels 9743"
Jolie says: Utils Service started at local://Utils, connected to local://Client

okt. 29, 2024 3:57:44 PM text-document.ol
SEVERE: C:\Users\niels\AppData\Local\npm-cache\_npx\e5d520739897bed5\node_modules\@jolie\languageserver\internal\text-document.ol:74: jolie.runtime.embedding.EmbeddedServiceCreationException: java.lang.ClassNotFoundException: inspector.Inspector

okt. 29, 2024 3:57:44 PM workspace.ol
SEVERE: C:\Users\niels\AppData\Local\npm-cache\_npx\e5d520739897bed5\node_modules\@jolie\languageserver\internal\workspace.ol:40: jolie.runtime.embedding.EmbeddedServiceCreationException: java.lang.ClassNotFoundException: inspector.Inspector

okt. 29, 2024 3:57:44 PM inspection-utils.ol
SEVERE: C:\Users\niels\AppData\Local\npm-cache\_npx\e5d520739897bed5\node_modules\@jolie\languageserver\internal\inspection-utils.ol:39: jolie.runtime.embedding.EmbeddedServiceCreationException: java.lang.ClassNotFoundException: inspector.Inspector

okt. 29, 2024 3:57:44 PM completionHelper.ol
SEVERE: C:\Users\niels\AppData\Local\npm-cache\_npx\e5d520739897bed5\node_modules\@jolie\languageserver\internal\completionHelper.ol:63: jolie.runtime.embedding.EmbeddedServiceCreationException: java.lang.ClassNotFoundException: inspector.PathsInJolie

Jolie says: Jolie Language Server started

Jolie says: Initialize message received

Jolie says: Initialization done 

I would again have expected the server to give an error.

kicito commented 4 weeks ago

I'm sorry for what you experienced, the error you encountered seems to be a bug from Jolie itself, not the extension. Looking at the log, can you ensure that lib/jolie-inspector-0.1.0.jar exists in C:\Users\niels\AppData\Local\npm-cache\_npx\e5d520739897bed5\node_modules\@jolie\languageserver? and what is your jolie version?

Niels-Erik commented 4 weeks ago

I've tested it on the release (1.12.1) and a version created from the master branch on https://github.com/jolie/jolie/commit/6c4a2c8d5109c63ddc60d075852ef88a8c763a4a. The folder, lib, does not exist at the given path.

kicito commented 4 weeks ago

I see. I assumed that your local language server library is outdated. In the recent versions (1.0.4), that directory should be available in the library. Could you try to remove the npx cache and restart the extension?

Niels-Erik commented 4 weeks ago

Yes I restarted the extension, however it it stuck in another way: output of Jolie LSP Clint: vscode-jolie lsp client: Start Jolie Language Server. output of Jolie LSP server:

Start LS Process with command cmd.exe /C npx --package=@jolie/languageserver@^2.0.0 joliels 9743
npm warn exec The following package was not found and will be installed: @jolie/languageserver@2.0.0

I deleted my npx cache and it seems that it is not downloading the new language server, or just downloads an empty folder. however running cmd.exe /C npx --package=@jolie/languageserver@^2.0.1 joliels 9743 in my terminal makes a folder that contains the language server.

Niels-Erik commented 4 weeks ago

Changing the extension code to use 2.0.1 it gives the following error now:

Start LS Process with command cmd.exe /C npx --package=@jolie/languageserver@^2.0.1 joliels 9743
okt. 31, 2024 4:04:44 PM launcher.ol
SEVERE: C:\Users\Niels Erik Jepsen\AppData\Local\npm-cache\_npx\1ebc473884da2048\node_modules\.bin\..\@jolie\languageserver\launcher.ol:31: jolie.runtime.embedding.EmbeddedServiceCreationException: java.lang.ClassNotFoundException: joliex.lang.RuntimeService

okt. 31, 2024 4:04:44 PM launcher.ol
SEVERE: C:\Users\Niels Erik Jepsen\AppData\Local\npm-cache\_npx\1ebc473884da2048\node_modules\.bin\..\@jolie\languageserver\launcher.ol:32: jolie.runtime.embedding.EmbeddedServiceCreationException: java.lang.ClassNotFoundException: joliex.io.FileService

Error: service initialisation failed
Niels-Erik commented 4 weeks ago

I checked on my laptop again with the change from my former comment, where it mostly work.

kicito commented 3 weeks ago

Today I tried the extension on Windows and fixed some issues on the vscode-jolie version 2.0.2. But it won't fix your recent error (quoted), as it indicates that your Jolie installation or the path environment is corrupt (unable to find standard libs Java classes). The extension requires Jolie version from master branch. After updating the extension and installing Jolie from git, please check your JOLIE_HOME / PATH, they should point to the directories in dist path e.g. JOLIE_HOME={JOLIE_REPO}/dist/jolie.

Changing the extension code to use 2.0.1 it gives the following error now:

Start LS Process with command cmd.exe /C npx --package=@jolie/languageserver@^2.0.1 joliels 9743
okt. 31, 2024 4:04:44 PM launcher.ol
SEVERE: C:\Users\Niels Erik Jepsen\AppData\Local\npm-cache\_npx\1ebc473884da2048\node_modules\.bin\..\@jolie\languageserver\launcher.ol:31: jolie.runtime.embedding.EmbeddedServiceCreationException: java.lang.ClassNotFoundException: joliex.lang.RuntimeService

okt. 31, 2024 4:04:44 PM launcher.ol
SEVERE: C:\Users\Niels Erik Jepsen\AppData\Local\npm-cache\_npx\1ebc473884da2048\node_modules\.bin\..\@jolie\languageserver\launcher.ol:32: jolie.runtime.embedding.EmbeddedServiceCreationException: java.lang.ClassNotFoundException: joliex.io.FileService

Error: service initialisation failed
Niels-Erik commented 3 weeks ago

I works now thank you. However there is some caveats that I'll write up in some other issues.

I'll close this issue when the requirement specifies the need for npx/npm.