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 454 forks source link

Remove kits/variants #4006

Open thernstig opened 2 months ago

thernstig commented 2 months ago

Brief Issue Summary

Here is a bold ask, and I am not sure it makes sense, but I thought it would not hurt to bring it up.

Both https://code.visualstudio.com/docs/cpp/cmake-linux and https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/cmake-presets.md recommends using CMake Presets, the official way to share CMake configs in various ways.

VS Code seems to include a Kits and Variants option, but it is not recommended.

I have never tried Kits/Variants, so it is possible they bring something to the table that CMake Presets does not, but if they do not do that, would it not simplify a lot by removing support for Kits/Variants altogether?

The rationale behind this is to make it easier to get started with VS Code and the CMake Tools extension. For example the CMake Kits and CMake Variants mentions nothing about that CMake Presets is preferred, whilst the other pages links above does.

I think you can close this immediately if it makes no sense, but I am coming from a point of having read all docs and felt this would simplify quite a bit just plainly removing this concept if it adds no extra value on top of CMake Presets.

Another benefit if that CMake Presets works better with teams that prefer to e.g. use other tools such as Vim or Emacs.

CMake Tools Diagnostics

n/a

Debug Log

n/a

Additional Information

No response

thernstig commented 2 months ago

Here is just one of many examples where this is confusing:

Reading https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/build.md it says:

CMake Tools builds by passing the --build flag to CMake. This flag is used as a generator-agnostic build invocation tool. CMake tools also passes --config <build-type>, based on the current build type from the active variant.

It speaks about variants such as if everyone had that, while that is not even recommended by other docs. Then going into the variants doc, it mentions nothing about the recommended CMake Presets approach. This leaves readers thinking they need to learn the Kits/Variants concept. Even if it is not recommended.

AnElectricalEngineer commented 2 months ago

My team extensively uses variants at work, it would be a shame if this feature was removed.

Variants are a VS code-related concept that can be used with CMake projects that otherwise do not use any sort of workflow configurations (e.g. presets). This is in contrast to presets, which are a CMake-native concept. Variants are very useful for environments in which multiple teams work on a large project that does not use presets because they allow only those developers who are interested in using the CMake extension with VScode to create different configurations that can quickly be swapped (e.g. Release, Debug), whilst not affecting the project itself in any way.

thernstig commented 2 months ago

@AnElectricalEngineer CMake Presets is better since it is editor agnostic. It is also a generic concept that if new developers in a team joins your project, they might have worked in another editor and never heard of variants/kits. So they have an unnecessary learning curve.

Imagine all editors out there had their own concept of kits/variants. Imagine maintaining all that for all editors, instead of just one way to do it: CMake Presets.

Forcing developers in any project to use a specific editor is in my opinion also a bad practice. You'd strip those developers accustomed to other editors of their muscle mind/skills with such editors.

But the main point is still that CMake Presets is a generic concept that more people would be aware about.

I think supporting it just adds to confusion in general for how to use CMake with VS Code.

caveat: Still if kits/variants absolutely brings something to the table that CMake Presets does not, then it might be worth the added complexity. I also understand that the owners/authors here for CMake wants to keep kits/variants because they think it adds a cool feature. My vantage point is it would allow them to remove the maintenance burden of the extension, simplify the code so that time can be better spent on other parts. I also understand some might consider it a weird ask to remove functionality, but it is a philosophical question in software development where I am on the side of less ways to do things, the better for everyone everywhere.

clnhlzmn commented 2 months ago

I like the idea of presets because for my workflow I would prefer to have the build configurations managed wholly with source code (i.e. not depend on a VSCode extension), but the combinatorial explosion problem with presets is currently preventing me from doing that. That is at least one significant thing that variants bring to the table.

thernstig commented 2 months ago

@clnhlzmn that is great feedback, then maybe this can be closed and revived in the future once those issues are solved. Unless there are many more of course.