microsoft / vscode-cmake-tools

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

Preset file expansion on open/save and expansion validation #3905

Closed qarni closed 4 months ago

qarni commented 4 months ago

Fixes #2934, #2781.

This change changes the way we do preset file expansion. Expansion now occurs upfront on file open or save, and if there are no errors, the expanded presets will be cached so repeated expansion is not necessary every time getAll{type of preset}Presets() is called.

The only time expansion will happen again is on set preset, which will then also apply the VS developer environment as needed. This is avoided on the initial expansion for performance.

If there are errors in expansion, the errors are shown in the problems panel per file. The presets file will also be set to undefined, which will invalidate that file and not allow any presets in that file to be recognized/selected as valid presets. This is in line with the CMake command line experience.

image

Some notes:

gcampbell-msft commented 4 months ago

Comment to remind to test these changes for this issue as well: #2934 , just wanted to remind since it's not a devenv issue, we don't want to forget it.

qarni commented 4 months ago

TODO's for follow up:

v-frankwang commented 3 months ago

@qarni We verified the two issue:https://github.com/microsoft/vscode-cmake-tools/issues/2934 and https://github.com/microsoft/vscode-cmake-tools/issues/2781 of this PR fix in CMake Tools: v1.19.45 and here are the results:

Issue:https://github.com/microsoft/vscode-cmake-tools/issues/2934

Selecting a configuration preset has been fixed: image Selecting a build preset is not fixed: I'm not sure if I'm not understanding your fix correctly, can you give me some advice? image

Issue:https://github.com/microsoft/vscode-cmake-tools/issues/2781 This issue has been fixed image