Bug 568206 - NPE trying to use clangd as a language server
Summary: NPE trying to use clangd as a language server
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-lsp (show other bugs)
Version: 10.0.1   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Nathan Ridge CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-25 01:49 EDT by Marc-André Laperle CLA
Modified: 2020-10-25 01:56 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc-André Laperle CLA 2020-10-25 01:49:19 EDT
Using CDT 10.0.1 (From EPP package)
Optional feature "LSP4E C/C++ Support" installed from CDT 10.x update site.

1. In the workspace preferences > C/C++ > C/C++ Language Server, I set the path to clangd, i.e. /Users/malaperle/git/llvm/build-release/bin/clangd
2. I created a hello world C/C++ project (Managed project Hello world c++ template).
3. In Project properties > C/C++ General > C/C++ Language Server, I checked "Prefer Language Server"
4. Right click on the .cpp file, Open with, Generic Test Editor.

When I try things like hover, content assist, I get several NPEs

Hover:

java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2086)
	at org.eclipse.lsp4e.operations.hover.LSPTextHover.getHoverRegion(LSPTextHover.java:225)
...
Caused by: java.lang.NullPointerException
	at org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor.lambda$5(LSContentAssistProcessor.java:178)
	at org.eclipse.lsp4e.LanguageServiceAccessor.lambda$15(LanguageServiceAccessor.java:590)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1146)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Content assist:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2086)
	at org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor.getContextInformationAutoActivationCharacters(LSContentAssistProcessor.java:312)
...
Caused by: java.lang.NullPointerException
	at org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor.lambda$5(LSContentAssistProcessor.java:178)
	at org.eclipse.lsp4e.LanguageServiceAccessor.lambda$15(LanguageServiceAccessor.java:590)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1146)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Comment 1 Marc-André Laperle CLA 2020-10-25 01:56:17 EDT
I forgot to mention that I do see the clangd process running in the background while the editor is opened.