CMake
CMake copied to clipboard
Feature Request:Clion Structure View-> display macros, functions , global cache vars
I'm not sure that this is a right place for a feature request. But I did not find any better way to communicate.
It would be nice if the plugin could deliver information to the structure view of the CLion IDE for cmake files.
To easy the navigation within files between functions / macros / find declaration of variables get an overview.
Especially would be nice to able to display functions in file structure dialog.
Yep, that's exactly the place for any feature requests. Implementing Structure View for CMake files is awesome idea. And as far as I can see is totally doable. Can't promise any timeframe but will try to implement at least simple MVP for feedbacks withing nearest weeks.
@csitarichie try this draft https://github.com/ArtsiomCh/CMake/releases/download/192.4.dev1/CMake-plus-192.4.dev1.jar and lets me know please your thoughts.
@csitarichie try this draft https://github.com/ArtsiomCh/CMake/releases/download/192.4.dev1/CMake-plus-192.4.dev1.jar and lets me know please your thoughts.
I have started to use it.
It looks good:
Now on the structure view, I have macros and functions displayed. And I can also jump now between definitions.
Exactly what I was thinking of.
see screenshot
https://photos.app.goo.gl/7LnoiTsZmB1Hnti76
Maybe as a separate feature variable declarations can be added. (I know the scope is a problem)
Thanks so far I think it is a big improvement in usability.
@csitarichie Thank you, Richard! Please try this pre-release version: https://github.com/ArtsiomCh/CMake/releases/download/192.4.dev3/CMake-plus-192.4.dev3.jar Use it with updated CMake simple highlighter please: https://github.com/ArtsiomCh/CMake/releases/download/192.4.dev3/CMake-simple-highlighter-192.4.dev3.jar Take close look at Structure View improvements:
- Variable (re)definitions added;
- Filtering by Functions, Macros, Variables;
- Navigation View<->Editor added;
Also would be glad to hear any suggestions and advice based on your experience. I don't use CMake a lot every day, so just trying to guess what is useful and convenient...
PS Also planning to add highlighting of functions and macros names with the ability to customize.
@csitarichie Thank you, Richard! Please try this pre-release version: https://github.com/ArtsiomCh/CMake/releases/download/192.4.dev3/CMake-plus-192.4.dev3.jar Use it with updated CMake simple highlighter please: https://github.com/ArtsiomCh/CMake/releases/download/192.4.dev3/CMake-simple-highlighter-192.4.dev3.jar Take close look at Structure View improvements:
- Variable (re)definitions added;
- Filtering by Functions, Macros, Variables;
- Navigation View<->Editor added;
Also would be glad to hear any suggestions and advice based on your experience. I don't use CMake a lot every day, so just trying to guess what is useful and convenient...
PS Also planning to add highlighting of functions and macros names with the ability to customize.
@ArtsiomCh it works fine.
see using it with a real CMake project: https://photos.app.goo.gl/fneujC6nc8auX3if8
One thing which would be good in my opinion is to add grouping to the variables.
Since in CMake, variables defined inside the function scope are visible only in the function and all function called from that function. It would be nice to put them under the function where they got defined not all under the file scope.
Furthermore, there are scope attributes to variables in the set function see: https://cmake.org/cmake/help/latest/command/set.html
set(<variable> <value>... [PARENT_SCOPE])
and
set(<variable> <value>... CACHE <type> <docstring> [FORCE])
these are very special cases: PARENT_SCOPE
and CACHE
maybe a different icons and color can be used in the structure view.
after that getting target name and they place of definition would be a big plus but that is difficult. Since the target name can use many indirections. (add_liblary, add_executable, add_custom_target) are the functions which can create targets.
One more thing came to my mind: CMake has very good documentation help engine even form command line as well it would be nice if the plugin would able to use that our doc display for the built-in functions there was an initiative with this plugin: https://plugins.jetbrains.com/plugin/8486-cmake-docs/
But it is not maintained and it is broken now :(. but having such functionality would be nice. but rather than fetching the help from the internet use the CMake local command-line help engine.
Never the less I think so far this is the most advanced CMake editing plugin.
Keep up the great work.
Well Done. !. Thaks !.
Thank you for testing on a real project!
Yeah, looks like variables scoping become a cornerstone for other functionality... I actually tried to implement it a while ago but bumped into that PARENT_SCOPE
modifier and gave up. It's time to give it a second try. ;)
Thanks for pointing to CMake Docs
abandoned :( plugin. Luckily it's open-sourced and It doesn't look too complicated to implement.
@csitarichie 193.1.1 - Quick Documentation for CMake commands, modules, policies, properties, and variables: Ctrl+Q and mouse hover (if enabled). Variable's scope of visibility is the first priority now.
@ArtsiomCh Thanks for your effort I give a trie.
@ArtsiomCh I have updated the new version directly from JetBrain's plugin store. It works without a problem and the documentation works as expected. I think it is a big plus. Even I'm maintaining 3000+ lines of CMake code. The inconsistency of the function parameter naming and usage makes me use the documentation all the time. Simply I just can not remember the exact syntax so now with the built-in docu I can write code faster.