-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Describe the bug
After a restart VS Code remembers that a file was a "Rascal DSL" file, so it starts seinding it to the parametric server.
This shows the user a whole bunch of errors:
stack trace:
/d:/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird
2025-09-29 13:32:45.436 [info] [Error - 1:32:45 PM] Request textDocument/documentSymbol failed.
2025-09-29 13:32:45.436 [info] Message: Unknown file: |file:///d:/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird|
Code: -32803
/d:/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird
2025-09-29 13:32:45.444 [info] [Error - 1:32:45 PM] Request textDocument/foldingRange failed.
2025-09-29 13:32:45.444 [info] Message: Unknown file: |file:///d:/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird|
Code: -32803
/d:/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird
2025-09-29 13:32:45.445 [info] [Error - 1:32:45 PM] Request textDocument/semanticTokens/full failed.
2025-09-29 13:32:45.445 [info] Message: Unknown file: |file:///d:/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird|
Code: -32803
/d:/swat.engineering/projects/sidn/bird
To Reproduce
Steps to reproduce the behavior:
- before register language, open a dsl file, and manually change the file type to
Parametric Rascal LSP - register the language
- open the file.
- lot's of error pop up
After this we can never recover, since we got no "didOpen" event for an extension that we support, so we dropped it, but all subsequent events get dropped too, so perhaps we should be a bit less picky about which events we drop in the parametric server, as it might be a race between the register language and the current state.
Expected behavior
- We should pickup changes that come in even if we missed the
didOpen - File that are already open should be supported in LSP
Stack traces
/d:/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird
2025-09-29 13:34:11.283 [warning] [parametric-1] org.eclipse.lsp4j.jsonrpc.RemoteEndpoint Notification threw an exception: {
"jsonrpc": "2.0",
"method": "textDocument/didChange",
"params": {
"textDocument": {
"version": 2,
"uri": "file:///d%3A/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird"
},
"contentChanges": [
{
"text": "module nesting_and_cycles2\n\nstruct Node {\n u8 a\n u8 b\n}\n\nchoice Loop(Node n) {\n struct {\n u8 _ ?(\u003d\u003d\"0\")\n }\n struct {\n u8 aRef ?(\u003d\u003dn.a)\n Node n1 ?(n1.a \u003d\u003d n.b) // the .b of this one is free\n Node n2 ?(n2.a \u003d\u003d n1.b) // the .b of this one is free\n Loop l(n1)\n }\n}\n\n\nstruct Start {\n u8 header ?(\u003d\u003d\"H\")\n Node initial\n Loop loop(initial)\n}\n\n\n// example input:\n// Hcdcdeefdeggh0 (nesting_and_cycles_test2.txt)\n// Start(initial \u003d Node(c,d),\n// loop \u003d Loop(\n// aRef \u003d c, \n// n1 \u003d Node(d, e), \n// n2 \u003d Node(e, f), \n// l \u003d Loop(\n// aRef \u003d d, \n// n1 \u003d Node(e, g),\n// n2 \u003d Node(g, h),\n// l \u003d Loop(_ \u003d 0)\n// ) \n// )) \n"
}
]
}
} org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Unknown file: |file:///d:/swat.engineering/projects/sidn/bird/bird-core/bird-src/nesting_and_cycles2.bird|
at org.rascalmpl.vscode.lsp.parametric.ParametricTextDocumentService.getFile(ParametricTextDocumentService.java:652)
at org.rascalmpl.vscode.lsp.parametric.ParametricTextDocumentService.getFile(ParametricTextDocumentService.java:646)
at org.rascalmpl.vscode.lsp.parametric.ParametricTextDocumentService.updateContents(ParametricTextDocumentService.java:345)
at org.rascalmpl.vscode.lsp.parametric.ParametricTextDocumentService.didChange(ParametricTextDocumentService.java:290)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
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: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:840)
Desktop (please complete the following information):
Based on: https://github.com/usethesource/rascal-language-servers/actions/runs/18044376262
Additional context
This used to work