apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.64k stars 844 forks source link

LSP client stops working on file after renaming it #7806

Open lcbarcellos opened 1 day ago

lcbarcellos commented 1 day ago

Apache NetBeans version

Apache NetBeans 23

What happened

When I rename a typescript file using project window, completion stops working on that file.

An unexpected exception shows up in notifications window like below (I've edited the file name):

org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request textDocument/completion failed with message: The document should be opened for completion, file: /path/to/typescript/file.ts
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209)
    at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193)
    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: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)
Caused: java.util.concurrent.ExecutionException
    at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
    at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
[catch] at org.netbeans.modules.lsp.client.bindings.CompletionProviderImpl$2.query(CompletionProviderImpl.java:161)
    at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:198)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1403)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2018)

If I rename the file back to its original name, completion starts working again. Closing file and reopening it also works around the issue.

Language / Project Type / NetBeans Component

No response

How to reproduce

Did this work correctly in an earlier version?

No / Don't know

Operating System

Ubuntu 22.04

JDK

OpenJDK Runtime Environment 17.0.12+7-Ubuntu-1ubuntu222.04

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

Every time.

Are you willing to submit a pull request?

No