Open i-garrison opened 4 months ago
Is this what you mean:
Yes this is what I'd like to have with CDT-LSP plugin too. Both r/w marking and also access to counter in foo call hierarchy.
Please be aware of that the call hierarchy is (currently) limited to function calls. See this clangd issue
Yes clangd does not provide that out of the box, still this can be implemented similar to what CDT editor does: it gets all variable references, finds containing functions and then stitches these to form displayed call tree. Would imagine it should be possible with CDT LSP plugin to do similar thing; you probably can store reference to function body for each variable reference and then while scanning for references build a tree going up from that function asking LSP for callers. Detecting if particular variable reference is read or write should be doable too.
Would imagine it should be possible with CDT LSP plugin to do similar thing
IMO a better solution would be to fix it on the server side. That's what its made and used for.
Would imagine it should be possible with CDT LSP plugin to do similar thing
IMO a better solution would be to fix it on the server side. That's what its made and used for.
Yes LSP server-side implementation is an option too, but looking at referenced clangd issue I do not think it will be available in clangd any time soon.
Currently CDT editor can show references to variable reads and writes annotated in call hierarchy.
Please add this feature to CDT LSP plugin. Since read and write access to variable is visible in function body provided by LSP it should technically be possible to bind these to function call hierarchies.
Lack of this feature can be partially worked around by wrapping variables into read/write accessor functions, but there are downsides: