Don't overwrite .vscode config if it already exists #2182
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Description
(Referencing issue #2181, the following content is copied from there)
Behaviour
The
$(PROJECT_TARGET)_configure
targets in tools/scripts/stm32.mk and tools/scripts/maxim.mk use the GNU Makefile
function to set up a default VS Code configuration for projects, with no regard to the contents of those files.no-OS/tools/scripts/maxim.mk
Lines 139 to 143 in 3cb5f58
For context, the content of the files is generated in vsc_intellisense.mk, vsc_openocd_debug.mk, and vsc_tasks.mk.
Impact
With the current makefiles, one may not change their VS Code config without it being reset to the no-OS defaults during the next build, which greatly hinders development. For instance, my WSL dev setup requires changing the gdb options in
launch.json
, but doing so is futile because the makefile resets my changes when building.Options
I suggest (this PR) adding a condition to only write to these files if they are empty or don't exist (i.e., during project setup), but keep their current content otherwise, to allow for customization of the config.
Despite some effort, I didn't manage to do it using just GNU Make syntax, but rather by changing the
file
call fromfilename.json
tofilename.json.default
, and having some shell commands conditionally copyfilename.json.default
tofilename.json
if the latter doesn't exist. Finally, shell commands remove the.default
files to keep the directory tidy.PR Type
PR Checklist