The goto definition is not working as expected. clangd #10870
Unanswered
lotus-trait
asked this question in
Troubleshooting
Replies: 1 comment
-
Have you tried to use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
When I open a file named a.c, I want to goto the function definition in b.c, but it goto the declaration in b.h instead.
If b.c is opened, then the jump is correct.
Reproduction Steps
anguages.toml
[[language]]
name = "c"
scope = "source.c"
injection-regex = "c"
file-types = ["c", "h"]
roots = [".git"]
comment-token = "//"
block-comment-tokens = { start = "/", end = "/" }
language-servers = [ "clangd" ]
indent = { tab-width = 2, unit = " " }
[language.debugger]
name = "lldb-dap"
transport = "stdio"
command = "lldb-dap"
[[language.debugger.templates]]
name = "binary"
request = "launch"
completion = [ { name = "binary", completion = "filename" } ]
args = { console = "internalConsole", program = "{0}" }
[[language.debugger.templates]]
name = "attach"
request = "attach"
completion = [ "pid" ]
args = { console = "internalConsole", pid = "{0}" }
[[language.debugger.templates]]
name = "gdbserver attach"
request = "attach"
completion = [ { name = "lldb connect url", default = "connect://localhost:3333" }, { name = "file", completion = "filename" }, "pid" ]
args = { console = "internalConsole", attachCommands = [ "platform select remote-gdb-server", "platform connect {0}", "file {1}", "attach {2}" ] }
[[grammar]]
name = "c"
source = { git = "https://github.com/tree-sitter/tree-sitter-c", rev = "7175a6dd5fc1cee660dce6fe23f6043d75af424a" }
Helix log
2024-05-17T18:39:40.773 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.773] clangd version 18.1.1 (Fedora 18.1.1-1.fc40)\n"
2024-05-17T18:39:40.773 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.773] Features: linux\n"
2024-05-17T18:39:40.773 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.773] PID: 211464\n"
2024-05-17T18:39:40.773 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.773] Working directory: /home//src\n"
2024-05-17T18:39:40.773 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.773] argv[0]: /usr/bin/clangd\n"
2024-05-17T18:39:40.773 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.773] Starting LSP over stdin/stdout\n"
2024-05-17T18:39:40.773 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.773] <-- initialize(0)\n"
2024-05-17T18:39:40.774 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.774] --> reply:initialize(0) 0 ms\n"
2024-05-17T18:39:40.774 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.774] <-- initialized\n"
2024-05-17T18:39:40.781 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.781] <-- textDocument/didOpen\n"
2024-05-17T18:39:40.781 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.781] Failed to find compilation database for /home//src/a.c\n"
2024-05-17T18:39:40.781 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.781] ASTWorker building file /home//src/a.c version 0 with command clangd fallback\n"
2024-05-17T18:39:40.781 helix_lsp::transport [ERROR] clangd err <- "[/home//src]\n"
2024-05-17T18:39:40.781 helix_lsp::transport [ERROR] clangd err <- "/usr/bin/clang -resource-dir=/usr/bin/../lib/clang/18 -- /home//src/a.c\n"
2024-05-17T18:39:40.818 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.818] Built preamble of size 975208 for file /home//src/a.c version 0 in 0.04 seconds\n"
2024-05-17T18:39:40.819 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.819] Indexing c17 standard library in the context of /home//src/a.c\n"
2024-05-17T18:39:40.826 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.826] --> textDocument/publishDiagnostics\n"
2024-05-17T18:39:40.870 helix_lsp::transport [ERROR] clangd err <- "I[18:39:40.870] Indexed c17 standard library: 2809 symbols, 30 filtered\n"
2024-05-17T18:40:30.017 helix_lsp::transport [ERROR] clangd err <- "I[18:40:30.017] <-- textDocument/definition(1)\n"
2024-05-17T18:40:30.017 helix_lsp::transport [ERROR] clangd err <- "I[18:40:30.017] --> reply:textDocument/definition(1) 0 ms\n"
2024-05-17T18:40:30.057 helix_lsp::transport [ERROR] clangd err <- "I[18:40:30.057] <-- textDocument/didOpen\n"
2024-05-17T18:40:30.058 helix_lsp::transport [ERROR] clangd err <- "I[18:40:30.057] Failed to find compilation database for /home//src/b.h\n"
2024-05-17T18:40:30.058 helix_lsp::transport [ERROR] clangd err <- "I[18:40:30.058] ASTWorker building file /home//src/b.h version 0 with command clangd fallback\n"
2024-05-17T18:40:30.058 helix_lsp::transport [ERROR] clangd err <- "[/home//src]\n"
2024-05-17T18:40:30.058 helix_lsp::transport [ERROR] clangd err <- "/usr/bin/clang -xobjective-c++-header -resource-dir=/usr/bin/../lib/clang/18 -- /home//src/b.h\n"
2024-05-17T18:40:30.101 helix_lsp::transport [ERROR] clangd err <- "I[18:40:30.101] Built preamble of size 1115832 for file /home//src/b.h version 0 in 0.04 seconds\n"
2024-05-17T18:40:30.102 helix_lsp::transport [ERROR] clangd err <- "I[18:40:30.102] Indexing c++17 standard library in the context of /home/***/src/b.h\n"
2024-05-17T18:40:30.105 helix_lsp::transport [ERROR] clangd err <- "I[18:40:30.105] --> textDocument/publishDiagnostics\n"
2024-05-17T18:40:31.135 helix_lsp::transport [ERROR] clangd err <- "I[18:40:31.135] Indexed c++17 standard library (incomplete due to errors): 14122 symbols, 1806 filtered\n"
Platform
fedora 40
Terminal Emulator
GNOME Terminal Version 3.50.1 for GNOME 45
Installation Method
dnf install helix
Helix Version
helix 24.3 (2cadec0)
Beta Was this translation helpful? Give feedback.
All reactions