go2sh / cmake-integration-vscode

CMake Server Interface for VSCode.
https://go2sh.github.io/cmake-integration-vscode/
Other
19 stars 11 forks source link

Feature request / Discussion: Quick start template #23

Open MathiasMagnus opened 5 years ago

MathiasMagnus commented 5 years ago

My problem

One of the most vexing things about CMake Tools and the CMake integration of Big Brother VS as well is that it takes too much time to just quickly get a text editor where I can type code and compile. It's a shame really, that the fastest way to get a tecbox for code and start writing is still godbolt. Could we get a little closer with VS Code?

Why?

There is no capability to customize the quick-start template. In Big Brother VS there is the project selection dialog which creates a baked project with a CMakeLists.txt that still requires tweaks (change /W4, /permissive-, etc.) Same with the Quick Start command of CMake Tools. (I tend to use THIS snippet as my jump-start) It would be awesome, if there were a way to customize the layout of the project, the stub of the CMakeLists.txt file it creates and perhaps even the CMakeCache.txt file so compilers need not be detected, as they change infrequently while ABI detection takes quite some time.

Solution?

Do you see value in being able to somehow provide the extension with a user provided project as a jump-start template? Files that are either configure by a CMake script via configure_file or a TypeScript that replaces some occurences? Providing a clean CMakeCache.txt file to start out from, the result of a script

cmake_minimum_required(VERSION 3.11)

enable_language(C)
enable_language(CXX)

could significantly speed up initial configuration. (There are some parts of the cache that hold non-portable path entries.)

Ultimately there is no one size fits all, so I think this would make a useful addition, and everyone could come up with their desired jump-start template.

go2sh commented 5 years ago

I understand you problem and I encountered it multiple times, also with different languages/project types. To get started, you need a lot of boilerplate code, which repeats over and over again.

I started to create another extension for the purpose of generating projects from templates, but its no where near to release...

But I could imagine to add some basic templates and commands to this extension in order to getting started quickly. Unfortunately, my time is currently limited, so I'am not able to tackle this any time soon, but I would happily accept a PR. :)

MathiasMagnus commented 5 years ago

You are right, it might make much more sense as a totally separate extension. A similar solution is Windows Template Studio which is fairly UWP-centric, but is essentially a nice take on the issue.