alephium / ralph-lsp

Ralph language server
6 stars 1 forks source link

FileSystemNotFound: Provider not installed #240

Closed tdroxler closed 4 weeks ago

tdroxler commented 1 month ago

Weird issue in vscode when opening the Source Control tab

image image

I could reproduce with the following:

git clone git@github.com:alephium/alephium-nft.git
cd alephium-nft
code .

Make a change to any contract, like just a new line.

Open the source control: Ctrl + Shift + G

From the source control tab, click on your contract

The error should pop up.

I didn't have time to check what was received by the server, but maybe the didOpen notification send something with an uri starting with git/// instead of the expected file///

simerplaha commented 1 month ago

I didn't have time to check what was received by the server, but maybe the didOpen notification send something with an uri starting with git/// instead of the expected file///

Yep, you are right. Good catch! URIUtil.getFileName errored (stacktrace from VSCode below). It errors for all APIs: open, code-completion, go-to def etc because git is not a supported URI yet.

This will have to be handled differently. I don't have a quick solution for this and it will need testing, specially for moved files. So temporarily, to stop that error, we can ignore processing files that do not have a file:/// scheme. WDYT?

StackTrace from VSCode's log output window Error - 12:26:24] Internal error occurred Cause: java.nio.file.FileSystemNotFoundException: Provider "git" not installed at java.base/java.nio.file.Path.of(Path.java:213) at java.base/java.nio.file.Paths.get(Paths.java:98) at org.alephium.ralph.lsp.pc.util.URIUtil$.getFileName(URIUtil.scala:36) at org.alephium.ralph.lsp.pc.util.URIUtil$.getFileExtension(URIUtil.scala:40) at org.alephium.ralph.lsp.pc.PC$.changed(PC.scala:83) at org.alephium.ralph.lsp.server.RalphLangServer.$anonfun$didChangeAndSet$1(RalphLangServer.scala:468) at org.alephium.ralph.lsp.server.RalphLangServer.didChangeAndSet(RalphLangServer.scala:595) at org.alephium.ralph.lsp.server.RalphLangServer.$anonfun$didChangeAndPublish$1(RalphLangServer.scala:447) at org.alephium.ralph.lsp.server.RalphLangServer.didChangeAndPublish(RalphLangServer.scala:595) at org.alephium.ralph.lsp.server.RalphLangServer.$anonfun$didOpen$1(RalphLangServer.scala:237) at org.alephium.ralph.lsp.server.RalphLangServer.didOpen(RalphLangServer.scala:595) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65) at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:160) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:231) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:198) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1623)
tdroxler commented 1 month ago

We can ignore processing files that do not have a file:/// scheme. WDYT?

Yes, anyway I don't think ralph-lsp should handle in anyway a git:/// file. We do receive them because we tell the client we want to watch all files, we could also choose to watch only *.ral, ralph.json and alephium.config.ts. The client then shouldn't send us the git files.

But It's still good to ignore other schemes, because a client could also send us something we didn't request

tdroxler commented 4 weeks ago

Fixed in https://github.com/alephium/ralph-lsp/pull/241