microsoft / vscode-cmake-tools

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

Update CMake Tools experience on open #3703

Closed gcampbell-msft closed 5 months ago

gcampbell-msft commented 5 months ago

Addresses #3588.

The goal of this PR is to make it easier and more obvious for people to utilize the cmake.ignoreCMakeListsMissing setting. This setting allows people to turn off the searching for a CMakeLists.txt quick pick when they are opening a project that does contain a CMakeLists.txt somewhere, but they aren't intending on using the folder as a CMake project.

This changes the default for cmake.configureOnOpen to true. It also removes the "Would you like to configure" pop-ups.

For the pop-up to select the CMakeLists.txt, we only pop this up on startup when cmake.configureOnOpen is true if we actually find a CMakeLists.txt within the folders that would've activated the extension.

@vlavati FYI, this is making a slight modification from your PR here: #3276

vlavati commented 5 months ago

@gcampbell-msft , thanks for the note!

I tried #3588 on current main branch and the dialog to select CMakelists is not shown only in case if "configureOnOpen" is persisted to "false". Then to configure the project it is possible to choose CMakelists.txt in vscode Explorer tree and run configure from context menu, or it is possible to run configure from the command palette (Ctrl+Shift+P).

In case of PR, if user opens folder and select "Not now" on "Would you like to configure project?", it is possible to see: image

In case of response "Not now", it looks confusing to see dialog to select CMakelists, but in case if option "configureOnOpen" is already persisted with "false", it is probably strange to see nothing if folder is opened. May be it is possible to implement steps like this:

So the option "configureOnOpen" is checked only in case of existing and previously configured projects. And if user opens the folder for the first time, the dialog to select CMakeLists is shown.

I hope this workflow is possible to implement and it will not break any user experience.

danniesim commented 5 months ago

@gcampbell-msft At this point, we might want to reduce the scope of #3646 to: Remove CTest project stubs of projects with ignoreCMakeLists set to true. That'll effectively make the folder scoped ignoreCMakeLists be the setting to enable/disable CMake Tools for a folder.

gcampbell-msft commented 5 months ago

@gcampbell-msft At this point, we might want to reduce the scope of #3646 to: Remove CTest project stubs of projects with ignoreCMakeLists set to true. That'll effectively make the folder scoped ignoreCMakeLists be the setting to enable/disable CMake Tools for a folder.

I agree. Also, it feels to me like the main issue is the ctest integration, and so it also feels to me like we should simply do a better job not integrating with the test explorer if there isn't a "valid" CmakeProject to interact with. In this case, a "valid" CMakeProject would refer to one that has a CMakeLists.txt defined.