bmd-studio / stm32-for-vscode

STM32 extension for working with STM32 and CubeMX in VSCode
MIT License
207 stars 27 forks source link

Suggestion: Change line separator when parsing cube makefile #186

Open olavfla opened 4 months ago

olavfla commented 4 months ago

Currently, it seems to convert multiline variables in the makefile to one line in src/getInfo/getCubeMakefileInfo.ts#L65, and separates the variables with spaces. However in some instances it could be useful to include spaces in the makefile, such as in my example: -DGIT_HASH=\"$(shell git rev-parse --short HEAD)\" \ to be able to output which commit is currently flashed. If i put this in the cube Makefile, it ends up like this in STM32Make.make:

-DGIT_BRANCH=\"$(shell \
-DHEAD)\" \
-Dgit \
-Drev-parse

I know this could just be defined in the yaml file instead, but i thought it would be nice to have something more universally compatible. I think this could be fixed by using a more unique separator than a space when parsing into a single line, or avoid parsing to a single line in the first place.

jortbmd commented 4 months ago

Hi! Thanks for opening up an issue. Yes the parsing is pretty naive and I did not account for this side effect. To tackle the parser should be build out a bit more. I will think about this as I do feel that these kind of use cases need to be supported. Will let you know when there is a fix. It might take some time as I do not have a lot of time to spend on the extension currently. If you want to fix it yourself you are more than welcome to create a pull request.