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

Multiple invalid targetUri for function declaration while jumping from cpp file to hpp file #946

Open
jbarik opened this issue Jul 20, 2023 · 0 comments

Comments

@jbarik
Copy link

jbarik commented Jul 20, 2023

Observed behavior

I think there is something wrong with how I am setting up ccls.

I am trying to jump to the declaration of a function from the definition in cpp file. Below is the request send from neovim and the response from ccls

[pid 3867781] <... read resumed>"Content-Length: 240\r\n\r\n{\"params\":{\"position\":{\"character\":27,\"line\":122},\"textDocument\":{\"uri\":\"file:\\/\\/\\/local-ssd\\/jbarik\\/ls_eventport2\\/matlab\\/src\\/sl_lang_blocks\\/ctrlport\\/ControlPortBlock.cpp\"}},\"id\":7,\"jsonrpc\":\"2.0\",\"method\":\"textDocument\\/definition\"}", 4096) = 263
[pid 3867781] read(0,  <unfinished ...>
[pid 3867782] write(1, "Content-Length: 1179\r\n\r\n{\"jsonrpc\":\"2.0\",\"id\":7,\"result\":[{\"targetUri\":\"file://../../../../../../src/sl_lang_blocks/export/include/sl_lang_blocks/ControlPortBlock.hpp\",\"targetRange\":{\"start\":{\"line\":49,\"character\":4},\"end\":{\"line\":49,\"character\":80}},\"targetSelectionRange\":{\"start\":{\"line\":49,\"character\":9},\"end\":{\"line\":49,\"character\":27}}},{\"targetUri\":\"file://../../../src/sl_lang_blocks/export/include/sl_lang_blocks/ControlPortBlock.hpp\",\"targetRange\":{\"start\":{\"line\":49,\"character\":4},\"end\":{\"line\":49,\"character\":80}},\"targetSelectionRange\":{\"start\":{\"line\":49,\"character\":9},\"end\":{\"line\":49,\"character\":27}}},{\"targetUri\":\"file://../../src/sl_lang_blocks/export/include/sl_lang_blocks/ControlPortBlock.hpp\",\"targetRange\":{\"start\":{\"line\":49,\"character\":4},\"end\":{\"line\":49,\"character\":80}},\"targetSelectionRange\":{\"start\":{\"line\":49,\"character\":9},\"end\":{\"line\":49,\"character\":27}}},{\"targetUri\":\"file:///local-ssd/jbarik/ls_eventport2/matlab/src/sl_lang_blocks/export/include/sl_lang_blocks/ControlPortBlock.hpp\",\"targetRange\":{\"start\":{\"line\":49,\"character\":4},\"end\":{\"line\":49,\"character\":80}},\"targetSelectionRange\":{\"start\":{\"line\":49,\"character\":9},\"end\":{\"line\":49,\"character\":27}}}]}", 1203) = 1203

The response contains 4 targetUris:

file://../../../../../../src/sl_lang_blocks/export/include/sl_lang_blocks/ControlPortBlock.hpp
file://../../../src/sl_lang_blocks/export/include/sl_lang_blocks/ControlPortBlock.hpp
file://../../src/sl_lang_blocks/export/include/sl_lang_blocks/ControlPortBlock.hpp
file:///local-ssd/jbarik/ls_eventport2/matlab/src/sl_lang_blocks/export/include/sl_lang_blocks/ControlPortBlock.hpp

All the targetUris point to ControlPortBlock.hpp, one absolute path and three relative paths. Some of those relative paths don't seem to be correct and result in errors in neovim - it can't find the files.

For some cpp files, I get only one targetUri, one containing absolute path. What can cause ccls to return multiple targetUri?

System information

  • ccls: ccls --version returns
  • clang version: 16.0.0
  • OS: Debian
  • Editor: Neovim
  • Language client (and version): nvim-lspconfig (latest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant