Description
Hi I have recently started using meson.
I'd like to add the following feature to vscode-meson.
What
When developing software using compiled languages such as c++ or rust, it often happens to switch between multiple build configurations such as so-called 'release' and 'debug'.
In meson, this is supposed to be done by creating multiple builddirs and switching between them. (see Using multiple build directories)
In vscode-meson, switching between builddirs requires rewriting mesonbuild.buildFolder
in settings.json, which is not very convenient.
I would like to be able to switch this easily.
How to work
I will explain how these can be realized given the knowledge gained from reading the threads and source code below. (because I'm new)
#201
#195
#188
#179
#101
#22
#103
Currently vscode-meson reactivates itself by calling reloadWindow
when sourceDir is selected or mesonbuild.buildFolder
is changed.
Although reloading is generally an undesirable behavior, I'd like to follow this behavior for the time being to minimize source code changes by reloading when switching buildDirs.
(Avoiding reloads should be a separate issue.)
Specification overview
-
Automatic launch of selection UI at first startup
Basically, add a buildDir selection flow after the user selects sourceDir.
This also includes leaving sourceDir as is and selecting only buildDir.-
buildDir selection UI
Unlike sourceDir selection, it does not search the file system to collect existing buildDir. User enters the path manually or selects from previous entries. -
Saving sourceDir selection
This buildDir selection is permanently remembered in memento, just like sourceDir.
On the next time startup, these values will be applied and the user does not need to make a selection.
-
-
Explicit selection UI launch from command or builddir selection via MesonProjectExplorer
Users can also launch the selection UI from the command palette or select a builddir directly from the MesonProjectExplorer in the side panel. -
Save format of buildDir
I expect that "mesonbuild.buildFolder" is probably unnecessary or a less important setting.
The buildDir selected by the UI is permanently saved in the format below.
Please note that multiple buildDirs are stored per sourceDir, and the most recently used one is placed at 0th.
type BuildConfig = {
buildDir: string; // path to builddir
friendlyName: string; // for displaying of MesonProjectExplorer
};
type BuildConfigMap = {
[sourceDir: string]: BuildConfig[] // multiple builddirs per sourceDir
};
// example
let buildDirsMap: BuildConfigMap = {
"path/to/sourceDir1": [
{
buildDir: "path/to/sourceDir1/build_dbg",
friendlyName: "x64_dbg",
},
{
buildDir: "path/to/sourceDir1/build_rel",
friendlyName: "x64_rel",
},
],
"path/to/sourceDir2": [
{
// It can also happen if buildDir is outside of sourceDir.
buildDir: "path/to/out/of/sourceDir2/build_dbg",
friendlyName: "x64_dbg",
},
{
buildDir: "path/to/out/of/sourceDir2/build_rel",
friendlyName: "x64_rel",
},
],
};
workspaceState.update("mesonbuild.buildDirsMap", buildDirsMap);
We need to discuss the details further, but for now I would like to hear everyone's opinions.
Thank you.