Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Autogenerate c_cpp_properties.json #1107

Closed

Conversation

iFreilicht
Copy link

Fixes #438, #808, #969

Potentially fixes other issues that stem from an incorrectly set up c_cpp_properties.json.

This PR adds an autogeneration mechanism to the extension. This way, library paths and macro definitions are added to c_cpp_properties.json automatically.

This fork is unfortunately a little older, so there may be some conflicts to fix, but I want to get it onto the radar, as it is a huge quality of life improvement and I've exclusively been using the development build of this fork because of that.

Builds of this fork of the extension can be found in this dropbox folder. Discussion around it is in #438 and this gitter chatroom.

Tagging @elektronikworkshop

* Tried to identify most of the tasks
* Added beer money support option
* First injection of the compiler command parser and IntelliSense auto-configuration. Currently injected into "verify" only.
* Updated branch documentation to reflect the current state of this project
…e replication, better maintainablility and readability

* Added pre-build command to "upload using programmer" since it was (probably unintentional) missing there
* Notes where to run the auto-generation
…uto-configuration to be turned off

* Prepared the compiler parser code to be injected into "upload" and "upload using programmer" without overhead
* Updated intellisense.ts to use only "let" instead of "var" which is much safer
* Updated branch documentation
…figuration flag which can override the global flag
* Made compile command regex match more stringent
…(comment))

* Added some ideas how to implement a better serial monitor
* Implemented c_cpp_properties merging -> compiler analysis results are merged into existing configuration and will preserve configurations of different name than the vscode-studio default configuration name (currently "Arduino"). This opens up the possibility for users to write their own configurations without having to disable the autogeneration.
* Implemented "write on change" - `c_cpp_properties.json` will only be written if a new configuration has been detected.
…le flags for analyze only. Now these flags have the same effect during regular builds.
* Added post build command support
* Added validator for both pre and post build (former was missing)
Yet to be decided: Solution for analysis run: with or without pre/post build?
Addresses microsoft#786
* Compacted log message filter regexes
* Moved pre-build command after initialization of the output folder in case this command somehow wants to operate on it somehow
* Better error message handling when post-build command fails
* Forwarding post-build command error
* Environment variables for pre-/post-build commands which give the user access to several build process parameters like the sketch, the output directory, serial port, build mode (verify, upload, analyze, ...), board type and workspace path
Addresses microsoft#786
… sketch wasn't initialized)

* More info in error message for uncaught exception during build cleanup
* Note on output path preparation which seems to be a bit wonky
…are applied during any build and can be used to set custom compiler flags and defines for instance.

Addresses microsoft#975
* Documentation for `buildPreferences`
* Web-server for library-, board-manager etc. was not listening on localhost but on the machine's main interface
* Web-server wasn't launched asynchronously what can cause problems
* Port was stored redundantly in webserver class
Addresses microsoft#966
@ghost
Copy link

ghost commented Sep 21, 2020

CLA assistant check
All CLA requirements met.

@robotdad
Copy link
Member

Is this ready for a review? If so I'll see if I can add it to the queue after we get the serial port issue resolved.

@iFreilicht
Copy link
Author

For a general code review, yes, but it was built against an older version of the extension and there was no time to update it yet. Do you want to have a look anyway or should it merge the current master first?

@robotdad
Copy link
Member

We'll discuss tomorrow morning here. Thank you for providing the PR, apologies it has sat here for so long.

@adiazulay adiazulay linked an issue Nov 12, 2020 that may be closed by this pull request
@adiazulay
Copy link
Contributor

@iFreilicht, can you rebase the current master branch on to this pr

@hlovdal
Copy link
Contributor

hlovdal commented Nov 17, 2020

Hi. I am not @iFreilicht, but I have rebased the branch on top of the latest master branch, see https://github.com/hlovdal/vscode-arduino/tree/intellisense-autoconfig.rebased. I have reviewed each of the rebased commits to see that they looked valid and have compiled and tested with the resulting branch which generated a proper.vscode/c_cpp_properties.json.

@iFreilicht iFreilicht marked this pull request as ready for review November 18, 2020 15:11
@iFreilicht
Copy link
Author

iFreilicht commented Nov 18, 2020

Thanks so much, @hlovdal! I created a new PR with your branch, see #1141, and will close this one.

@iFreilicht iFreilicht closed this Nov 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

changing the default c_cpp_properties created
5 participants