netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

LSP client stops working on file after renaming it

Open lcbarcellos opened this issue 1 year ago • 1 comments

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

  • Open a typescript file
  • check whether completion is working
  • Go to Projects Window (ctrl + 1)
  • Rename that file
  • Go back to file edit window. Completion should not work anymore
  • An exception should be present in Notifications window

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

lcbarcellos avatar Sep 27 '24 15:09 lcbarcellos

@lcbarcellos thanks for bringing this up. I noticed the problem in the past, but always postponed looking further. Please have a look at #7829. There is a nightly build with the change Checks page direct link Please see if that fixes the issue for you.

matthiasblaesing avatar Oct 04 '24 18:10 matthiasblaesing