Closed hongxuchen closed 1 year ago
Sounds like a nice idea - I don't have time to implement this right now, but I can look at a PR
My neovim/lua kungfu is not powerful enough right now but I will try when I can 😄
Just now I noticed that there seems no need for a hack, Clangd's typeHierarchy/resolve
response already contains the position info (uri
, range
and selectionRange
).
Ah thanks, I'll look at it in some time
Implemented in 7f003d48d2b846aeb364d153d7defc7e3cea42bd
For now, this plugin directly calls what clangd server provides and render results in nvim's buffers. In particular, it provides
ClangdTypeHierarchy
command which shows the parent and child types of the symbol under cursor when the symbol corresponds a C++ type, in a separated buffer.Unfortunately, it seems clangd itself does not provide the position information of the the parent and child types; thus it cannot be used for code navigation. Is it possible to combine a few requests to (patially) achieve this goal? For example, in the separated buffer of
ClangdTypeHierarchy
command, clangd_extensions.nvim asynchronously invokevim.lsp.buf.workspace_symbol
(or telescope.builtin.lsp_workspace_symbols if present) to additionally request the symbol under the cursor and filter with type definition likestruct
/class
, etc. Indeed it is a hack, but I think this would be quite useful for me.