cmake-language-support icon indicating copy to clipboard operation
cmake-language-support copied to clipboard

Go To Definition for custom functions/macros

Open itavero opened this issue 3 years ago • 2 comments

Would it be possible to somehow get from CMake which modules are loaded (or where certain functions / macros are defined), perhaps via the CMake File API, and use that information to support the Go To Definition action?

I'm not super familiar with the CMake File API, but it seems that the CMake Tools extension from Microsoft is also using it. In one of the generated files in my build directory I found a backtraceGraph that seemed to provide information on some of the functions I've defined as well as where (which file and line) they are defined.

And on a related note, if that information can be retrieved from CMake:

  • can we also search for references in all included CMake files?
  • would it be possible to somehow add documentation to our CMake functions / macros that can be visible when hovering over the function/macro call in a different source file?

itavero avatar Aug 19 '22 13:08 itavero

Have you tried using cmake.languageSupport.enableFileAPI as explained in https://marketplace.visualstudio.com/items?itemName=josetr.cmake-language-support-vscode?

josetr avatar Oct 14 '22 03:10 josetr

I'm not sure if I have done so. I'm returning back to work next month (currently enjoying paternity leave). I'll have a look at it then and let you know if that's indeed what I was looking for.

itavero avatar Oct 14 '22 17:10 itavero