lf-lang / vscode-lingua-franca

Lingua Franca extension for Visual Studio Code
Other
5 stars 3 forks source link

VS code plugin fails when installed locally with a branch of lingua-franca #172

Closed edwardalee closed 1 month ago

edwardalee commented 1 month ago

With a clean clone of the VS Code plugin, created this way:

git clone git@github.com:lf-lang/vscode-lingua-franca.git
cd vscode-lingua-franca
git submodule update --init --recursive
npm install

the plugin crashes with the following error message:

[Error - 10:48:03 AM] Error during request: : java.lang.NullPointerException: Cannot invoke "org.eclipse.sprotty.SModelRoot.getType()" because "server.currentRoot" is null
    at de.cau.cs.kieler.klighd.lsp.KGraphDiagramUpdater.lambda$updateDiagram$5(KGraphDiagramUpdater.java:212)
    at de.cau.cs.kieler.klighd.lsp.KGraphLanguageServerExtension.lambda$doRead$21(KGraphLanguageServerExtension.java:683)
    at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$1(ReadRequest.java:66)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
[Error - 10:48:03 AM] Error during request: : java.lang.NullPointerException: Cannot invoke "org.eclipse.sprotty.SModelRoot.getType()" because "server.currentRoot" is null
    at de.cau.cs.kieler.klighd.lsp.KGraphDiagramUpdater.lambda$updateDiagram$5(KGraphDiagramUpdater.java:212)
    at de.cau.cs.kieler.klighd.lsp.KGraphLanguageServerExtension.lambda$doRead$21(KGraphLanguageServerExtension.java:683)
    at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$1(ReadRequest.java:66)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
petervdonovan commented 1 month ago

I failed to reproduce this on commit 9147d7c7d12ecba4cd960456ba45796df1636f34 (I made a tiny change to the clean command in package.json, but that should not be relevant).

To me, it looks like the diagram server has an invalid internal state. Therefore, it seems likely that the issue is either specific to the exact project being opened, or it comes from a specific sequence of actions and would go away after restarting the diagram server (which can be done by restarting all of VS Code). Furthermore, based on the stack trace, it also seems likely that the source of the problem is either in Sprotty or in KlighD, and not in this repository nor in lingua-franca.

Please re-open this issue if more details can be provided on reproduction steps.

edwardalee commented 1 month ago

Sorry, but this issue is still there. I put the master branch in lingua-franca, do git submodule update --init --recursive and npm install, and when I start code, I get this:

image

The output looks like this:

[Info  - 8:33:31 AM] Connection to server got closed. Server will restart.
Error: Unable to access jarfile /Users/edwardlee/.vscode/extensions/lf-lang.vscode-lingua-franca-0.8.1/lib/lflang-lds.jar

Indeed, that file is missing. The VS code extension has set itself to use the "Release" version, even though it was previously set to use the "Prerelease" version, and now it can't find the release version jar file (because it's not there). I tried uninstalling the Lingua Franca extension in VS code before running npm install, but this also did not work. It again tries to use the release version when restarted. I can get it to work by switching to the prerelease version, but that version is pulled from the network. It is not the version on which I ran npm install.

So I cannot find any way to run the VS code extension with any version of LF except the release and prerelease version.

edwardalee commented 1 month ago

Apparently, this has been fixed recently in the vscode-lingua-franca repo.