Closed ValdemarGr closed 10 months ago
This seems to be a bug instead of a missing feature. It should work as expected.
Everything is working fine, this is caused by an exception in metals:
Params: {
"textDocument": {
"uri": "file:///home/valde/git/redacted/%3Cno%20file%3E"
},
"buildTarget": {
"uri": "@//src/main/scala/redacted/booking:booking"
},
"diagnostics": [
{
"range": {
"start": {
"line": -1,
"character": -1
},
"end": {
"line": 0,
"character": 0
}
},
"severity": 3,
"code": "0",
"message": "java.time.Duration \u003c: scala.collection.immutable.SortedMap[java.time.LocalDate,redacted.Booking]?",
"relatedInformation": []
},
{
"range": {
"start": {
"line": -1,
"character": -1
},
"end": {
"line": 0,
"character": 0
}
},
"severity": 3,
"code": "0",
"message": "false",
"relatedInformation": []
}
],
"reset": true
}
error:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
at org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer.consume(TracingMessageConsumer.java:114)
at scala.meta.internal.metals.RequestMonitorImpl$$anon$1.consume(ServerLivenessMonitor.scala:41)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 13 more
Caused by: java.nio.file.NoSuchFileException: /home/valde/git/gateway/<no file>
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
at java.base/java.nio.file.Files.newByteChannel(Files.java:422)
at java.base/java.nio.file.Files.readAllBytes(Files.java:3206)
at scala.meta.internal.io.PlatformFileIO$.slurp(PlatformFileIO.scala:45)
at scala.meta.internal.io.FileIO$.slurp(FileIO.scala:24)
at scala.meta.internal.mtags.ScalametaCommonEnrichments$XtensionAbsolutePath.toInput(ScalametaCommonEnrichments.scala:383)
at scala.meta.internal.metals.Diagnostics.onPublishDiagnostics(Diagnostics.scala:167)
at scala.meta.internal.metals.Diagnostics.onBuildPublishDiagnostics(Diagnostics.scala:147)
at scala.meta.internal.metals.clients.language.ForwardingMetalsBuildClient.onBuildPublishDiagnostics(ForwardingMetalsBuildClient.scala:112)
... 17 more
severity: 3
means information.
PublishDiagnosticsParams
requires a TextdocumentIdentifier
, but arbitary information does not always have a text document?
The diagnostic
Diagnostics:
1. type mismatch;
found : java.time.Duration
required: scala.collection.immutable.SortedMap[java.time.LocalDate,redacted.Booking] [0]
Is also reported, do I just ignore severity: 3
?
If we have:
A
has an error that was transitively caused byC
.C
is rebuilt with a fix, unfortunatelyC
now fails.Clearly
B
and transitivelyA
cannot be rebuilt sinceC
now fails. The diagnostics inA
should be cleared.Maybe the BEP can tell me what targets should be rebuilt, and we just clear diagnostics for all those targets?
Ideally I would like diagnostics to hang around as long as they could be relevant; Diagnostics should only be cleared if newer ones arrive, they succeed, or transitive targets fail?