Closed xhuohai closed 3 years ago
it is really hard for us to figure this out without a reproducer, can you share the code? the most obvious things that comes to mind is PP regions, if the section you are running hover/go-to-definition on is in a disabled region (e.g. due to different build configuration), clangd cannot provide you with features.
it is really hard for us to figure this out without a reproducer, can you share the code? the most obvious things that comes to mind is PP regions, if the section you are running hover/go-to-definition on is in a disabled region (e.g. due to different build configuration), clangd cannot provide you with features.
@kadircet, thanks for your reply. The code is part of a project from my work, which is not allowed to share.
In addation, line 1500 and 1501 are in the same function.
Does the line number really appear significant/magic here? e.g. if you add a few blank lines, do you stop getting completions on the last few lines where it previously worked?
If you can't share the code (understandable) maybe you can see how much you can simplify the file and have the problem still persist. Maybe this will result in a minimized example that you can share, or maybe you discover something interesting about what circumstances the problems triggers on.
(I assume you've tried go to def at several different points after line 1500 and they all fail?)
Problem solved! I noticed that clang complains there are two many errors( actually warnings), go-to-definition works as expected after having the errors fixed. Thank you @kadircet and @sam-mccall.
I have a big cpp file which has more than 8000 line, everything works fine for the first 1500 lines. But from line 1501, go-to-definition stop to work, when I put the mouse on a function, nothing happens.
Logs V[11:46:38.992] <<< {"id":129,"jsonrpc":"2.0","method":"textDocument/hover","params":{"position":{"character":72,"line":1501},"textDocument":{"uri":"file:///data/huochenghai/GNNE/k510-gnne-compiler/src/transforms/k510/gnne_tile.cpp"}}}
I[11:46:38.992] <-- textDocument/hover(129) I[11:46:38.993] --> reply:textDocument/hover(129) 1 ms V[11:46:38.993] >>> {"id":129,"jsonrpc":"2.0","result":null}
I[11:46:38.993] --> textDocument/clangd.fileStatus V[11:46:38.993] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///data/huochenghai/GNNE/k510-gnne-compiler/src/transforms/k510/gnne_tile.cpp"}}
V[11:46:39.893] <<< {"id":130,"jsonrpc":"2.0","method":"textDocument/definition","params":{"position":{"character":72,"line":1501},"textDocument":{"uri":"file:///data/huochenghai/GNNE/k510-gnne-compiler/src/transforms/k510/gnne_tile.cpp"}}}
I[11:46:39.893] <-- textDocument/definition(130) I[11:46:39.894] --> reply:textDocument/definition(130) 0 ms V[11:46:39.894] >>> {"id":130,"jsonrpc":"2.0","result":[]}
I[11:46:39.894] --> textDocument/clangd.fileStatus V[11:46:39.894] >>> {"jsonrpc":"2.0","method":"textDocument/clangd.fileStatus","params":{"state":"idle","uri":"file:///data/huochenghai/GNNE/k510-gnne-compiler/src/transforms/k510/gnne_tile.cpp"}}
System information Clangd version (from the log, or
clangd --version
): 10.0.0-4ubuntu1~18.04.2 clangd extension version: 0.1.11 Operating system: Ubuntu 18.04