xpack / vscode-xpack-extension-ts

A Visual Studio Code C/C++ managed build extension
https://xpack.github.io/vscode/
MIT License
9 stars 0 forks source link

Fix c_cpp_properties.json line terminator #42

Closed ilg-ul closed 8 months ago

ilg-ul commented 1 year ago

Check the logic to update c_cpp_properties.json, to avoid rewriting it if not necessary.

ghost commented 8 months ago

Hi Liviu,

Effectively, I observe that the c_cpp_properties.json file is rewritten at each save of the packages.json...

...And trig a line ending modification of the last line: I work on Windows but I save my files with UNIX line ending. Each time that package.json is saved, the line ending format of the last line of the c_cpp_properties.json file is modificated. From LF to CRLF.

ilg-ul commented 8 months ago

the c_cpp_properties.json file is rewritten at each save of the packages.json.

That's correct, it must reflect the possible changes in build configurations.

the line ending format of the last line of the c_cpp_properties.json file is modificated. From LF to CRLF.

Yes, this is weird, the JSON serialiser uses only LF, even on Windows, and my code adds the portable definition os.EOL, which on Windows is CRLF.

I fixed the line termination, now it is a single LF, please upgrade to 0.5.2.

ghost commented 8 months ago

Thank you Liviu, it works fine 🙏

ilg-ul commented 8 months ago

Great, thank you for confirming.