microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.47k stars 454 forks source link

[feature_request] display all visited cmake files in CMake project outline #655

Open DoDoENT opened 5 years ago

DoDoENT commented 5 years ago

Brief Issue Summary

I recently migrated from using QtCreator to VSCode with this extension for my daily development due to VSCode having much better support for different languages (no more need to have 3 editors for editing python, C++ and Groovy code in the same project) and also because VSCode's C++ debugger is simply awesome - much better than the one provided by QtCreator.

However, I am missing one feature: in QtCreator when I configured my CMake project, its CMake outline displayed all CMake files that were visited (traversed) during the CMake configuration process. On the other hand, the CMake outline in VSCode displays only CMakeLists.txt files for each of my projects but does not display all *.cmake files that were included (either directly or transitively) from the main CMakeLists.txt. Adding support for that would make VSCode much more usable, especially because quick open feature would then be able to open CMake files that were used, even though if they are not directly part of the workspace, but are included from CMAKE_MODULE_PATH folders (as is case when using Conan package manager and Conan package that provides some CMake utilities).

Expected:

CMake outline view should display all *.cmake files that were visited during the CMake configuration process.

Apparent Behavior:

CMake outline view displays only source files for each project and main CMakeLists.txt file.

Platform and Versions

dcourtois commented 5 years ago

Hi,

Could you provide a small example ? In my current projects I don't see anything missing in the CMake view of VSCode compared to the one in QtCreator.

Ideally a screenshot of the view in QtCreator and the corresponding view in VSCode to highlight what's missing would be great :)

DoDoENT commented 5 years ago

Hi! Here is a sample project that demonstrates the issue. You will need conan package panager to run it.

Here is how it looks like in VSCode:

Screenshot 2019-04-05 at 23 27 07 CEST

and here is how it looks like in QtCreator:

Screenshot 2019-04-05 at 23 27 20 CEST

Note that files Project.cmake, Project.srcs.cmake, ProjectTest.cmake and ProjectTest.srcs.cmake do not appear in VSCode outline, even though those files are executed by CMake.

Even better, notice the statement include( FindGTest ) (added just to demonstrate the issue, even though this example does not use it). VSCode is not aware of the FindGTest.cmake (which comes from the gtest conan package and pressing Cmd+P and searching for FindGTest.cmake does not result with anything. On the other hand, QtCreator nicely displays full path to FindGTest.cmake (it shows nicely that it came from different path) and pressing Cmd+K and searching for FindGTest.cmake immediately finds it.

When having lots of cmake scripts coming from various external paths (mostly from my private conan packages) it is quite annoying that VSCode CMake outline is not aware of them, even though cmake normally executed them.

I hope this now better explains the issue and gives you the way of reproducing it.

dcourtois commented 5 years ago

Yup, thanks ! In my projects I'm using find_package, and the files did not appear in QtCreator, so I didn't understand what you meant :) If I can find a bit of time, I'll see if it can be done ! (I'm not the owner of this addon, just trying to help with some occasional pull requests :))

github-actions[bot] commented 1 year ago

This issue is now marked as 'stale-old' due to there being no activity on it for the past 720 days. Unless the 'stale-old' label is removed or the issue is commented on, this will be remain open for at least 14 days and then it may be closed. If you would like to make this issue exempt from getting stale, please add the 'stale-exempt' label.