Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDT LSP editor features are not available #228

Closed
EmergReanimator opened this issue Jan 13, 2024 · 8 comments
Closed

CDT LSP editor features are not available #228

EmergReanimator opened this issue Jan 13, 2024 · 8 comments

Comments

@EmergReanimator
Copy link

EmergReanimator commented Jan 13, 2024

All of the features below are not active.

Auto completion
Hovering
Formatting
Go to Declaration
Find References
Code actions (Declare implicit copy/move members, Extract to function/variable, rename)
Quick Fix (Ctrl+1)
Type hierarchy
Call hierarchy
Outline view

It used to work sometimes ago (back to beginning of the December 2023, see #222 ). But it doesn't want to interact anymore.
No errors or any clue that could pinpoint to the failure root cause.
Note that the .clangd is created correctly.

The C++ editor works as expected.

image

Here is the environment and the list of the installed plugins

  • Eclipse 2023-12 (4.30.0)

  • C/C++ LSP Support 1.1.0.202401111656 org.eclipse.cdt.lsp.feature.feature.group Eclipse CDT

  • Eclipse TM4E TextMate support in Eclipse IDE - Language Configurations 0.5.7.202308132047 org.eclipse.tm4e.languageconfiguration

  • Eclipse TM4E TextMate support in Eclipse IDE - Registry management 0.6.5.202308132047 org.eclipse.tm4e.registry

  • Eclipse TM4E TextMate support in Eclipse IDE - UI 0.7.1.202308132047 org.eclipse.tm4e.ui

  • Eclipse TM4E TextMate support in Java 0.6.1.202308132047 org.eclipse.tm4e.core

  • Eclipse CDT Clangd Language Server Support 1.0.0.202401111656 org.eclipse.cdt.lsp.clangd

  • Eclipse CDT Language Server based C/C++ Editor 1.0.0.202401111656 org.eclipse.cdt.lsp

  • Eclipse.org Language Server Protocol client for Eclipse IDE (Incubation) 0.18.1.202311121506 org.eclipse.lsp4e

  • clangd --version
    Ubuntu clangd version 15.0.7
    Features: linux+grpc
    Platform: x86_64-pc-linux-gnu

  • which clangd
    /usr/bin/clangd

@ghentschke
Copy link
Contributor

ghentschke commented Jan 14, 2024

It seems that the language server has not been started after opening the file in the LSP based C/C++ editor.
Please check if clangd is running. Either by checking in the Language Servers view:
Window -> Show View -> Other... -> Language Servers -> Language Servers:
image
Or by checking the console log as described here

Another way is to start the Eclipse IDE from console withe this arguments: -consoleLog or -consolelog
Then you should see something like this on the console:

I[20:33:58.586] clangd version 17.0.3 (https://github.com/llvm/llvm-project 888437e1b60011b8a375dd30928ec925b448da57)
I[20:33:58.587] Features: windows+grpc
I[20:33:58.587] PID: 9964
I[20:33:58.587] Working directory: C:\Users\ghent\cdt-main\eclipse
I[20:33:58.587] argv[0]: C:\temp\clangd_17.0.3\bin\clangd.exe
I[20:33:58.587] argv[1]: --clang-tidy
I[20:33:58.587] argv[2]: --background-index
I[20:33:58.587] argv[3]: --completion-style=detailed
I[20:33:58.587] argv[4]: --pretty
I[20:33:58.587] argv[5]: --query-driver=C:/Daten/msys64/mingw64/bin/*
I[20:33:58.592] Starting LSP over stdin/stdout
I[20:33:58.645] <-- initialize("1")
I[20:33:58.647] --> reply:initialize("1") 2 ms
I[20:33:58.659] <-- initialized
I[20:33:58.664] <-- textDocument/didOpen
I[20:33:58.705] System includes extractor: successfully executed C:\Daten\msys64\mingw64\bin\clang.exe
	got includes: "C:/Daten/msys64/mingw64/include/c++/11.2.0, C:/Daten/msys64/mingw64/include/c++/11.2.0/x86_64-w64-mingw32, C:/Daten/msys64/mingw64/include/c++/11.2.0/backward, C:/Daten/msys64/mingw64/lib/clang/13.0.0/include, C:/Daten/msys64/mingw64/x86_64-w64-mingw32/include, C:/Daten/msys64/mingw64/include"
	got target: "x86_64-w64-windows-gnu"
I[20:33:58.705] <-- textDocument/inlayHint("2")
I[20:33:58.705] <-- textDocument/documentLink("3")
I[20:33:58.705] <-- textDocument/semanticTokens/full("4")
I[20:33:58.710] --> textDocument/publishDiagnostics
I[20:33:58.710] --> textDocument/publishDiagnostics
I[20:33:58.711] Loaded compilation database from C:\Users\ghent\cdt-main\runtime-New_configuration\Cmk1\build\default\compile_commands.json
I[20:33:58.711] --> window/workDoneProgress/create(0)
I[20:33:58.711] Enqueueing 1 commands for indexing
I[20:33:58.723] <-- reply(0)
I[20:33:58.724] --> $/progress
I[20:33:58.724] --> $/progress
I[20:33:58.759] System includes extractor: successfully executed C:\Daten\msys64\mingw64\bin\clang++.exe
	got includes: "C:/Daten/msys64/mingw64/include/c++/11.2.0, C:/Daten/msys64/mingw64/include/c++/11.2.0/x86_64-w64-mingw32, C:/Daten/msys64/mingw64/include/c++/11.2.0/backward, C:/Daten/msys64/mingw64/lib/clang/13.0.0/include, C:/Daten/msys64/mingw64/x86_64-w64-mingw32/include, C:/Daten/msys64/mingw64/include"
	got target: "x86_64-w64-windows-gnu"
I[20:33:58.760] ASTWorker building file C:\Users\ehent\cdt-main\runtime-New_configuration\Cmk1\Cmk1.cpp version 1 with command 
[C:/Users/ehent/cdt-main/runtime-New_configuration/Cmk1/build/default]
"C:\\Daten\\msys64\\mingw64\\bin\\clang++.exe" --driver-mode=g++ -IC:/Users/ehent/cdt-main/runtime-New_configuration/Cmk1/build/default -o "CMakeFiles\\Cmk1.dir\\Cmk1.cpp.obj" -c -isystem C:/Daten/msys64/mingw64/include/c++/11.2.0 -isystem C:/Daten/msys64/mingw64/include/c++/11.2.0/x86_64-w64-mingw32 -isystem C:/Daten/msys64/mingw64/include/c++/11.2.0/backward -isystem C:/Daten/msys64/mingw64/lib/clang/13.0.0/include -isystem C:/Daten/msys64/mingw64/x86_64-w64-mingw32/include -isystem C:/Daten/msys64/mingw64/include --target=x86_64-w64-windows-gnu "-resource-dir=C:\\temp\\clangd_17.0.3\\lib\\clang\\17" -- "C:\\Users\\ehent\\cdt-main\\runtime-New_configuration\\Cmk1\\Cmk1.cpp"
I[20:33:58.781] <-- textDocument/documentHighlight("5")
I[20:33:58.835] --> $/progress
I[20:33:58.835] --> $/progress
I[20:33:58.939] <-- textDocument/documentSymbol("6")
I[20:33:59.066] Built preamble of size 3312732 for file C:\Users\ehent\cdt-main\runtime-New_configuration\Cmk1\Cmk1.cpp version 1 in 0.30 seconds
I[20:33:59.067] Indexing c++17 standard library in the context of C:\Users\ehent\cdt-main\runtime-New_configuration\Cmk1\Cmk1.cpp
I[20:33:59.082] --> textDocument/publishDiagnostics
I[20:33:59.082] --> reply:textDocument/inlayHint("2") 376 ms
I[20:33:59.082] --> reply:textDocument/documentLink("3") 376 ms
I[20:33:59.082] --> reply:textDocument/semanticTokens/full("4") 376 ms
I[20:33:59.082] --> reply:textDocument/documentHighlight("5") 301 ms
I[20:33:59.082] --> reply:textDocument/documentSymbol("6") 142 ms
I[20:33:59.098] <-- textDocument/foldingRange("7")
I[20:33:59.099] --> reply:textDocument/foldingRange("7") 1 ms
I[20:33:59.104] <-- textDocument/documentHighlight("8")
I[20:33:59.104] --> reply:textDocument/documentHighlight("8") 0 ms
I[20:33:59.441] <-- textDocument/documentSymbol("9")
I[20:33:59.441] --> reply:textDocument/documentSymbol("9") 0 ms
I[20:34:01.020] Indexed c++17 standard library (incomplete due to errors): 12956 symbols, 849 filtered

Do you have enabled any project specific settings:
image

Can you please provide an Eclipse log as well?

@EmergReanimator
Copy link
Author

@ghentschke Thanks for helping me out here!


Can you please provide an Eclipse log as well?

Here the complete Eclipse console log with enabled language server console logs.

/opt/tools/eclipse-cpp-2023-12-R/eclipse -consolelog
Jan 14, 2024 9:46:36 PM org.apache.aries.spifly.BaseActivator log
INFO: Registered provider org.slf4j.simple.SimpleServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle slf4j.simple
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [lngpck.source.regexp.python]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [lngpck.source.glsl]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [lngpck.source.sql]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [lngpck.source.asm]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [lngpck.source.x86]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [lngpck.source.x86_64]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [lngpck.source.arm]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.registry.Registry _doLoadSingleGrammar
WARNING: No grammar source for scope [lngpck.source.cpp.embedded.macro]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find grammar for scopeName [lngpck.source.regexp.python]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: REMOVING BeginEndRule{id=148,name=string.quoted.double.raw.regex.cpp} ENTIRELY DUE TO EMPTY PATTERNS THAT ARE MISSING
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find grammar for scopeName [lngpck.source.glsl]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: REMOVING BeginEndRule{id=152,name=meta.string.quoted.double.raw.glsl.cpp} ENTIRELY DUE TO EMPTY PATTERNS THAT ARE MISSING
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find grammar for scopeName [lngpck.source.sql]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: REMOVING BeginEndRule{id=156,name=meta.string.quoted.double.raw.sql.cpp} ENTIRELY DUE TO EMPTY PATTERNS THAT ARE MISSING
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find rule for scopeName [#preprocessor_number_literal]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find rule for scopeName [#preprocessor_number_literal]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find grammar for scopeName [lngpck.source.cpp.embedded.macro]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: REMOVING IncludeOnlyRule{id=1730,name=null} ENTIRELY DUE TO EMPTY PATTERNS THAT ARE MISSING
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find grammar for scopeName [lngpck.source.asm]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find grammar for scopeName [lngpck.source.x86]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find grammar for scopeName [lngpck.source.x86_64]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find grammar for scopeName [lngpck.source.arm]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find rule for scopeName [#string_escaped_char]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find rule for scopeName [#c_conditional_context]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find rule for scopeName [#c_conditional_context]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find rule for scopeName [#c_conditional_context]. I am [cpp-grammar]
Jan 14, 2024 9:46:43 PM org.eclipse.tm4e.core.internal.rule.RuleFactory _compilePatterns
WARNING: CANNOT find rule for scopeName [#block_innards]. I am [cpp-grammar]

Do you have enabled any project specific settings:

No, I changed nothing there.

image

@EmergReanimator
Copy link
Author

Please check if clangd is running. Either by checking in the Language Servers view:

No servers are running.

image

@ghentschke
Copy link
Contributor

image

@EmergReanimator
Copy link
Author

EmergReanimator commented Jan 15, 2024

Yes, you are right. This is the root cause!

However, I have to admit, I expected, that the language server is activated as soon as the CDT LSP editor is open.

The name and the description of this option is misleading.
The better name of the check box would be smth. like: Enable C/C++ Editor (LSP)

image

@ghentschke
Copy link
Contributor

ghentschke commented Jan 15, 2024

However, I have to admit, I expected, that the language server is activated as soon as the CDT LSP editor is open.

I understand that this could be confusing. The intention was that the user decides which editor should be used when opening a C/C++ file via double click. The use case to select the new editor via the context menu and expect that it should run was not on my mind, but it sounds reasonable to me.

The better name of the check box would be smth. like: Enable C/C++ Editor (LSP)

That's not quite correct, because this checkbox sets the new C/C++ editor as default. Set C/C++ Editor (LSP) as default or something like that would be better.

@ghentschke ghentschke closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2024
@emaayan
Copy link

emaayan commented Dec 15, 2024

a

what about code refactoring?

@jonahgraham
Copy link
Member

a

what about code refactoring?

Hi @emaayan - this bug is about a specific problem a user was having and has now been resolved. If you are experiencing a problem, please raise a new issue describing the problem you are facing so we can help you. Unfortunately "what about code refactoring" does not have enough context for me to know how to help.

@eclipse-cdt eclipse-cdt locked as resolved and limited conversation to collaborators Dec 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants