Made make vscode compatible with MSYS2 and added make clangd#36
Merged
evolentini merged 2 commits intolabmicro:mainfrom Jul 8, 2025
Merged
Conversation
The first version of `make vscode` relied on echo processing the `\n` escape sequence in single-quoted text. This happens in mac os and linux's default shell *sh* but not in MSYS2's default shell *bash* which requires a `-e` switch. This same switch is echoed unmodified by sh's version of `echo`, so it is not a viable solution. As a workaround, newlines are replaced by `>>>>` (a sequence that shouldn't appear in text) and then filtering through awk to reliably replace the sequence by a newline before redirecting to create the configuration file. To support users of the clangd LSP (for instance, vim users) a new target, `make clangd` was added. This target creates a `compile_flags.txt` file in the repository's root, with flags that setup clangd in a manner similar to vscode. This also requires newlines but here `tr` was used as a filter in place of `awk` because the input is a space-separated list and the only substitution necessary is space to newline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The first version of
make vscoderelied on echo processing the\nescape sequence in single-quoted text. This happens in mac os and linux's default shell sh but not in MSYS2's default shell bash which requires a-eswitch. This same switch is echoed unmodified by sh's version ofecho, so it is not a viable solution.As a workaround, newlines are replaced by
>>>>(a sequence that shouldn't appear in text) and then filtering through awk reliably replaces the sequence by a newline before redirecting to create the configuration file.To support users of the clangd LSP (for instance, vim users) a new target,
make clangdwas added. This target creates acompile_flags.txtfile in the repository's root, with flags that setup clangd in a manner similar to vscode. This also requires newlines but heretrwas used as a filter in place ofawkbecause the input is a space-separated list and the only substitution necessary is space to newline