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

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 57c8d2d
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Mon Mar 22 13:00:21 2021 -0700

    update changelog

commit 6e65997
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Mon Mar 22 12:49:56 2021 -0700

    bump to v0.4.0

commit 6d63a01
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Tue Mar 9 08:54:05 2021 -0800

    update version

commit ed886ad
Merge: 6ecfc55 9ca2400
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Mon Mar 8 14:01:55 2021 -0800

    Merge branch 'develop' into pre-release-v0.4.0

commit 9ca2400
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Fri Mar 5 09:58:10 2021 -0800

    remove -MMD from complier args for intellisesne (#1208)

commit 6ecfc55
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Feb 18 11:27:45 2021 -0800

    update version in package

commit 1126581
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Feb 18 11:07:59 2021 -0800

    update readme

commit 5571e52
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Feb 18 10:52:24 2021 -0800

    update package-lock

commit 0b60f1f
Merge: e044711 e97bad8
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Feb 18 09:59:26 2021 -0800

    Merge branch 'master' into pre-release-v0.4.0

commit e044711
Merge: 739aa95 5f4c400
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Feb 4 14:32:52 2021 -0800

    Merge branch 'develop' of https://github.com/microsoft/vscode-arduino into pre-release-v0.4.0

commit 739aa95
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Feb 4 14:21:55 2021 -0800

    pre release v0.4.0

commit 5f4c400
Merge: b7094ba 595def8
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Feb 4 11:53:29 2021 -0800

    Merge branch 'master' into develop

commit b7094ba
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Fri Jan 22 14:56:07 2021 -0800

    remove IntelliSense Auto branch notes

commit b0375c8
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Wed Jan 20 09:45:43 2021 -0800

    Bump ini from 1.3.5 to 1.3.8 (#1159)

    Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
    - [Release notes](https://github.com/isaacs/ini/releases)
    - [Commits](npm/ini@v1.3.5...v1.3.8)

    Signed-off-by: dependabot[bot] <support@github.com>

    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Adi Azulay <adazulay@microsoft.com>

commit f80b38f
Author: Jason Tranchida <jtranchida@gmail.com>
Date:   Tue Jan 19 16:41:36 2021 -0800

    Populate the list of programmers by parsing programmers.txt for each package (#1129)

    * Improved handling of programmer selection

    - Selected programmer is now saved to and loaded from the arduino.json file
    - Arduino.json is monitored for changes, and changing file will update selected programmer & ui
    - Programmer selection UI now shows both the friendly name of the programmer, as well as the arduino name
    - Minor fix to deviceContexts to fire change events after all states are modified
    - Layed groundwork to support querying list of programmers for the current board from arduino toolchain

    * Parse the list of programmers from packages

    * Tests for parsing programmers

    * Show board specific list of programmers when selecting

    Populate the selected programmer and it's display name using list of programmers provided by BoardManager.  When selecting programmer, only present the user a list of programmers relevant to the current board.

    * Initial set of tests for ProgrammerManager

    * add support for cli

    * fix hardcoded package name for programmers

    * adds programmer.key back to support arduino IDE

    * fix handeling of programmer name in ide and cli

    Co-authored-by: Adi Azulay <adazulay@microsoft.com>

commit 8bb1130
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Tue Jan 19 12:16:15 2021 -0800

    fix missing "

commit a717e5b
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Tue Jan 19 12:11:25 2021 -0800

    update travis

commit 9d1899e
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Tue Jan 12 12:25:51 2021 -0800

    remove redundant prebuild check

commit 7ac331f
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Tue Jan 12 12:08:33 2021 -0800

    fix verbose setting and cli programmer upload

commit b91a5ca
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Dec 10 16:41:17 2020 -0500

    fix cli analyze mode

commit 2e763c8
Author: Adi Azulay <adazulay@microsoft.com>
Date:   Thu Dec 10 15:53:53 2020 -0500

    add support for cli

commit b5360b5
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Jan 7 00:39:08 2021 +0100

    Remove arrow-head anti-pattern

commit 0356bb7
Author: Håkon Løvdal <kode@denkule.no>
Date:   Wed Jan 6 23:03:06 2021 +0100

    Join args.push statements

commit b97a740
Author: Håkon Løvdal <kode@denkule.no>
Date:   Wed Jan 6 22:38:23 2021 +0100

    Replace "upload" with "compile --upload"

commit e591480
Author: Håkon Løvdal <kode@denkule.no>
Date:   Wed Jan 6 21:25:59 2021 +0100

    Reverse and merge tests

commit 5a49b97
Author: Håkon Løvdal <kode@denkule.no>
Date:   Tue Jan 5 22:23:21 2021 +0100

    Remove compile argument and expand BuildMode with CliUpload and CliUploadProgrammer

commit 8b83873
Author: Håkon Løvdal <kode@denkule.no>
Date:   Tue Jan 5 23:34:25 2021 +0100

    Consolidate all boardDescriptor argument pushing

commit a6512a4
Author: Håkon Løvdal <kode@denkule.no>
Date:   Mon Jan 4 21:48:51 2021 +0100

    Move the _build to the end and make private

commit c2ab577
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 29 14:39:38 2020 +0100

    Updated log, additional stuff and beers

commit 8a491ed
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 29 13:50:28 2020 +0100

    Fixed security issue

    * 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 #966

commit 5f32221
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 29 12:15:17 2020 +0100

    Add and document buildPreferences setting

    * Validator for `buildPreferences`
    * Documentation for `buildPreferences`

commit 9543ba7
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 29 11:24:35 2020 +0100

    Support for Arduino preferences in `arduino.json`. These preferences are applied during any build and can be used to set custom compiler flags and defines for instance.
    Addresses #975

commit f9cd3c5
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 29 07:55:37 2020 +0100

    Fix too early initialization of cocopa

    * Fixed bug with build: initializing cocopa too early (was failing if 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

commit 48c4c64
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 29 01:04:29 2020 +0100

    Updated log, status and beers

commit 95f5a18
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 29 00:32:05 2020 +0100

    Documentation for pre-/post-build commands and their environment variables

commit f85a783
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 28 23:57:08 2020 +0100

    Full cmd support for pre-/post-build commands on Windows
    Addresses #786

commit 2af8f11
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 28 23:19:56 2020 +0100

    Pre-/post-build command improvements

    * Full bash syntax support for pre-/post-build commands on UNIX systems
    * 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 #786

commit d3bcf6e
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 28 21:07:50 2020 +0100

    Logging and post-build commands

    * Error logging for exceptions during build cleanup
    * 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

commit 7c1104c
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 28 15:29:32 2020 +0100

    Section which outlines additional features this branch addresses

commit 2b84aa8
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 28 15:28:21 2020 +0100

    C++ standard is now parsed from compiler arguments

    Plus: Moved some methods to cocopa and got rid of the typed-promisify dependency

commit f6c3b2c
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 22:49:54 2020 +0100

    Added post build command support

    * 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 #786

commit 7039ea8
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 21:21:33 2020 +0100

    IntelliSense auto gen respected global and project specific dis-/enable flags for analyze only. Now these flags have the same effect during regular builds.

commit deaa18a
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 21:02:49 2020 +0100

    Collapsing multiple consecutive newlines into a single newline for non verbose build log

commit 30210dc
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 19:47:44 2020 +0100

    Make upload verbosity be conditional and extend filtering

    * Building always verbosely but upload only verbosely when requested
    * Filtering of spurious messages now with regex list and for all platforms

commit fed508f
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 19:44:35 2020 +0100

    Filter out invalid include directories

    * Filtering out invalid include directories (discovered when compiling for ESP8266)
    * Compacted IntelliSense message and hint to manual build into a single line

commit 194dc92
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 18:40:27 2020 +0100

    Fixed exception which occurs if one of the include directories doesn't exists and we try to search it for Arduino.h

commit 70d323d
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 18:36:01 2020 +0100

    Fixed bug in board.ts: Conceptual flaw when checking if configuration option is valid

commit 314d4a8
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 16:11:33 2020 +0100

    Build/analysis logging improvements

commit b489a8f
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 27 14:03:58 2020 +0100

    Run IntelliSense analysis for every build

    * Run IntelliSense analysis for every build
    * Added global enum for log level

commit 88e544a
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 16:36:40 2020 +0100

    Added link to alpha releases to top of document

commit 15fd705
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 16:21:12 2020 +0100

    Updated beers

commit 27d9cac
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 16:15:06 2020 +0100

    Final pull request dependency style for cocopa

commit e7f7d05
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 16:14:15 2020 +0100

    Updated log

commit 764d21e
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 15:57:00 2020 +0100

    Refined some documentation comment

commit deecdf2
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 15:48:54 2020 +0100

    Changed Serial.updatePortListStatus to make use of optional argument to eliminate updatePortListStatus(null) calls

commit cdf9f34
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 15:46:40 2020 +0100

    Added/reviewed some notes

commit 4202508
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 15:28:52 2020 +0100

    Reworked util.spawn to mergable version

commit d408686
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 26 14:22:52 2020 +0100

    Removed IS-REMOVE code

    * Removed code marked with `IS-REMOVE` previously
    * Added constant for the `c_cpp_properties.json`-configuration managed by vscode-arduino
    * Removed code rendered dead by the previous removal

commit 31e530c
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Tue Feb 25 17:16:15 2020 +0100

    Updated cocopa to version 0.0.12

    * Implemented and tested support for `.cpp`-sketches.
    * Done implementing the most relevant unit tests in cocopa.
    * Two independent alpha testers confirmed proper working of the previous alpha releases.
    * Updated to the latest revision of cocopa.

commit b5714b6
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sun Feb 23 18:34:33 2020 +0100

    Updated log and beers

commit f2a5307
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sun Feb 23 18:26:31 2020 +0100

    Forceinclude Arduino.h

    * Added message to end of each build to inform user how to update the IntelliSense configuration
    * The magic now searches all identified include paths for the Arduino core include file (aka Arduino.h) and adds it as forced include - most users expect Arduino core functionality to work without having to include this header. Added typed-promisify to dependencies since I made use of it in the new code for better readability.
    * Conclude is now asynchronous
    * Updated branch status and added new future task
    * Bumped cocopa version to 0.0.10

commit b7effbc
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 22 23:29:15 2020 +0100

    Updated log

    * Updated branch log and beers

commit 5fe6dbc
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 22 23:17:59 2020 +0100

    IntelliSense config generator

    * Now normalizes generated include paths
    * Bumped cocopa to 0.0.9

commit 4238e12
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 22 20:33:16 2020 +0100

    Updated to latest cocopa which features X-platform support and better lexer

commit e6c10cd
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 22 20:24:30 2020 +0100

    Updated log and beers

commit 2d52e52
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 22 14:25:22 2020 +0100

    Fixed handling of invalid manual configurations. Improved code locality for board configuration manipulation and fixed a race condition with fine grained event handling. Details:

    Added missing checks when board configurations are loaded from the configuration file:
    * Up to now vscode-arduino blindly loaded any board configuration from `arduino.json` even if this would result in invalid board configurations which in turn lead to compilation (verify, upload) failure.
    * Up to now this state couldn't be recovered by simply removing the offending configuration from the configuration file. Even worse: it stored the wrong configuration in between board changes.

    To reproduce the bug in 0.2.29

    1. Select Arduino Nano with the *Arduino Board Configuration*
    2. Set configuration in `arduino.json` to `cpu=cray2` and save
    3. Verify -> fails
    4. Switch board to Arduino Uno
    5. Switch back to Arduino Nano: The wrong configuration is back and now the user can't even select another (correct) configuration from the *Arduino Board Configuration* window
    6. Delete the wrong configuration and save -> verify still fails

    `vscode-arduino` does not fall back to a default configuration. The user has now two options: find the correct configuration by himself and set it within arduino.json. Very experienced users could probably accomplish that. Everone else can just restart vscode.

    I corrected that by enhancing IBoard.loadConfig and IBoard.updateConfig member functions to
    * check for proper formatting of the config string loaded from `arduino.json`
    * check if the configuration IDs and the option IDs are valid

    If any of the above fails, the functions bail out and return the error. The board manager then loads a default configuration and issues a warning, that the configuration is invalid. This way the user gets the chance to fix her/his configuration but gets informed at the same time, that a different configuration than the intended is loaded (prevents surprises).

    This situation is only relevant, when users start fiddling with the configuration values in `arduino.json`. As long as they just set the board and the configurations from within the *Arduino Board Configuration Window* nothing bad can happen. But now custom configurations are handled in a cleaner way.

    The DeviceContext's board configuration was set in board.ts and boardManager.ts in different places - even when it was loaded after a DeviceContext's configuration update event which is prone to infinite loops. This has been resolved and it's not re-written/re-set during loading a configuration on change.

    This is valid for board manager's updateStatusBar function which fiddled with the board and the configuration. Now updateStatusBar really just updates the status bar. And it isn't necessary to call it from outside the board manager anymore due to proper event handling which identifies the situations during which the status bar has to be updated. Therefore this member is now private.

    In board manager itself operations that affect device context and current board now happen only within doChangeBoardType and the event handlers of DeviceContext callbacks onDeviceContextConfigurationChange and onDeviceContextBoardChange. This prevents the accidental creation of infinite event loops, makes the code more understandable, maintainable and therefore resilient against future bugs.

commit 640f269
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 21 21:45:52 2020 +0100

    Removed obsolete doc folder as all this is now part of cocopa

commit 98dbc0d
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 21 00:40:16 2020 +0100

    Updated log, status and beers

commit 01e92e9
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 19 23:59:01 2020 +0100

    Added "some" additional issues -- currently I've found 28!

commit 5fd1a27
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 19 23:01:36 2020 +0100

    Updated log and beers.

commit c15dc08
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 19 22:45:54 2020 +0100

    IntelliSense auto-analysis integration

    * Reworked DeviceContext for fine grained event generation on settings change
    * Added dedicated settings classes which allows for the latter
    * Changed board manager and serial monitor to used the new fine grained events instead of the "something changed event" - which makes the code marginally more efficient
    * Implemented an analysis manager which takes care of analysis requests generated by settings change events and makes sure that analysis builds don't interfere with regular builds
    * Adapted the build infrastructure within ArduinoApp such that it allows for the above
    * Removed the global build guard and moved it to ArduinoApp (there is a corner case though for programmer selection within extension.ts which I marked with a TODO
    * Fixed some linting issues but did not lint most of the stuff committed here - this will be part of a later commit
    * I left notes here and there where I saw things which should/could be improved/changed
    * Removed the try/catch guards from the build invocations within extension.ts since exceptions are handled within the build function itself
    * Changed the project setting parameter for the IntelliSense setup to reflect its workings better

commit 548c714
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 19 19:36:36 2020 +0100

    Updated and completed documentation of the current state within README.md

    * Updated project log and status

commit 59bad21
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 19 16:18:15 2020 +0100

    Updated project log and status

commit cabeed6
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Tue Feb 18 20:12:07 2020 +0100

    Updated log and issues

    * Added/documented all known related issues
    * Updated log
    * Updated and extended status
    * General brushing of structure and text

commit d6c7b5a
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Tue Feb 18 18:21:21 2020 +0100

    New classes which will improve the device settings management and event handling. To be integrated with one of the next commits.

commit d712a94
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Tue Feb 18 13:26:09 2020 +0100

    Don't use hard coded paths when possible.

commit 6c1fe68
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Tue Feb 18 01:54:11 2020 +0100

    Updated project log

commit 41bcd44
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Mon Feb 17 16:38:12 2020 +0100

    Disabled and marked all previous implementations of IntelliSense support for later removal using `IS-REMOVE`

commit 3418458
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 23:25:51 2020 +0100

    Fix whitespace

commit f914a4b
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 23:18:01 2020 +0100

    Add arduino.rebuildIntelliSenseConfig

commit 216e1b8
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 23:14:26 2020 +0100

    Merge build and verify

commit 2a2db50
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 23:12:03 2020 +0100

    Make build and verify identical

commit 2039739
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 22:53:33 2020 +0100

    Make build return boolean

commit fef2db0
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 18:07:15 2020 +0100

    Use cocopa and add Analyze build mode

commit 0b2b77a
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 00:27:21 2020 +0100

    Rename output to buildDir

commit 335d80a
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 00:10:17 2020 +0100

    Add stdoutCallback expression

commit 4aa7ddc
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 23:52:29 2020 +0100

    Add buildMode argument to verify

commit e4a70b0
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 23:39:12 2020 +0100

    Merge upload and uploadUsingProgrammer into one build function

commit a14f777
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 23:36:46 2020 +0100

    Make upload and uploadUsingProgrammer identical

commit 76c74cf
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 23:26:46 2020 +0100

    Add buildMode argument to upload and uploadUsingProgrammer

commit 86719a3
Author: Håkon Løvdal <kode@denkule.no>
Date:   Tue Jan 5 23:03:58 2021 +0100

    Spelling correction

commit cd9365b
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 23:00:46 2020 +0100

    Move selectProgrammer down

commit e03dc38
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 22:26:39 2020 +0100

    Move arg buildup earlier in functions

commit 88bed5e
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 21:57:40 2020 +0100

    Inline and move appPath later

commit 8227014
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 21:52:59 2020 +0100

    Add selectSerial expression

commit 990c1a1
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 21:36:40 2020 +0100

    Add cleanup expression

commit 0678c9a
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 21:09:50 2020 +0100

    Unify exit error message

commit b28f574
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 20:59:19 2020 +0100

    Unify util.spawn invocation

commit a6968e0
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 20:45:53 2020 +0100

    Introduce verbose variable

commit 3879639
Author: Håkon Løvdal <kode@denkule.no>
Date:   Thu Dec 10 20:21:12 2020 +0100

    Move args variable till top of upload, uploadUsingProgrammer and verify

commit dd308ac
Author: Håkon Løvdal <kode@denkule.no>
Date:   Tue Dec 8 22:40:05 2020 +0100

    Rename verifyResult to success

commit e4c13d0
Author: Håkon Løvdal <kode@denkule.no>
Date:   Tue Dec 8 22:24:21 2020 +0100

    Rename Logger to logger

commit a5d4695
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 15 20:49:13 2020 +0100

    Updated branch notes -- documented changes not committed though.

commit 5945d8d
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 15 12:47:31 2020 +0100

    Updated beer money log

commit 56c9634
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 12 18:12:43 2020 +0100

    Note how to run vscode without having gulp on your user path

commit 4341261
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 12 17:53:28 2020 +0100

    More on beta testing, added link to chat room

commit e80a338
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 12 17:00:26 2020 +0100

    Added instructions how to run development code

commit 6a42d3f
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Mon Feb 10 05:17:19 2020 +0100

    Moved intellisense function to a separate file

commit 4f6565c
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Mon Feb 10 02:33:24 2020 +0100

    Minor documentation rub

commit 40bb52d
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Mon Feb 10 02:26:03 2020 +0100

    Merge c_cpp_properties results with existing configuration

    * More unit testing within cocopa.
    * 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.

commit 67281ae
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sun Feb 9 18:25:01 2020 +0100

    Moved arduino specifics from cocopa to vscode-arduino

commit 3cba412
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sun Feb 9 16:40:00 2020 +0100

    Notes about serial monitor

    * Added more serial monitor ideas from [John Lonergan](#463 (comment))
    * Added some ideas how to implement a better serial monitor

commit d87402d
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sun Feb 9 13:23:48 2020 +0100

    Fix regression and improve regex matching

    * Fixed regression introduced with adaptions to latest version of cocopa
    * Made compile command regex match more stringent

commit 39c3f79
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sun Feb 9 11:51:43 2020 +0100

    Fix issue 771

    * Fixes the line splitting regex as outlined in #771
    * Removed a redundand condition

commit dd3254d
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sun Feb 9 04:24:52 2020 +0100

    Incorporated the latest progress from cocopa development

commit bb2ce83
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 8 16:29:08 2020 +0100

    Try to generate IntelliSense configuration even when the compilation fails

commit 819d2f1
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 8 16:12:58 2020 +0100

    Added IntelliSense setup auto-generation project (sketch-context) configuration flag which can override the global flag

commit f28dd7e
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 8 13:08:59 2020 +0100

    Updated earned :beers:

commit 0865c97
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 8 12:28:25 2020 +0100

    Moved compiler parser to cocopa package for better testability and maintainability

commit d337295
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 8 03:10:06 2020 +0100

    Documenting ...

commit 4a91647
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 7 03:19:09 2020 +0100

    Moved TODO in branch documentation

commit 59c78cb
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 7 03:15:53 2020 +0100

    Added even more TODOs to branch documentation

commit ce1b656
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 7 03:11:14 2020 +0100

    Added two more TODOs to branch documentation

commit 3da2f76
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 7 02:55:26 2020 +0100

    IntelliSense on/off configuration and compiler parser injection preparation

    * Added a global configuration switch which allows the IntelliSense auto-configuration to be turned off
    * Prepared the compiler parser code to be injected into "upload" and "upload using programmer" without overhead
    * Updated branch documentation

commit bc2b292
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 6 23:34:40 2020 +0100

    Documentation updates

    * Notes regarding settings
    * Notes where to run the auto-generation

commit baaf069
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 6 23:30:36 2020 +0100

    Pre-build command updates

    * Moved pre-build command into separate member function to reduce code replication, better maintainablility and readability
    * Added pre-build command to "upload using programmer" since it was (probably unintentional) missing there

commit 79bd476
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 6 23:29:32 2020 +0100

    Improved line splitting of built-in include parser after commenting on a pull request :)

commit 16e861d
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 6 21:48:34 2020 +0100

    Added IntelliSense compiler parsing engine code

    * Added IntelliSense compiler parsing engine code
    * 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

commit 82513e4
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Thu Feb 6 01:06:03 2020 +0100

    More documentation update

    * More investigations and documentation, especially on intrinsic/built-in compiler header include paths

commit 5debfb4
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 5 21:33:16 2020 +0100

    Update documentation

    * More documentation on this project
    * Tried to identify most of the tasks
    * Added beer money support option

commit 0291850
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Wed Feb 5 16:28:45 2020 +0100

    Branch for the implementation of the automagical IntelliSense configuration

commit 48418e2
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sun Feb 23 20:14:28 2020 +0100

    Removed unused import

commit 5daa2b1
Author: Håkon Løvdal <kode@denkule.no>
Date:   Fri Dec 11 18:13:55 2020 +0100

    Add missing return values

commit 57f4aa4
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 22 14:25:22 2020 +0100

    Fix @Property

commit 2e490b5
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Fri Feb 7 02:08:35 2020 +0100

    Fixed spelling.

commit ddb804f
Author: Uli Franke <hoi@elektronikworkshop.ch>
Date:   Sat Feb 8 13:05:30 2020 +0100

    Fixed misspelled function name

commit d6459d0
Author: Jason Tranchida <jtranchida@gmail.com>
Date:   Tue Dec 8 13:19:45 2020 -0800

    Improved handling of programmer selection (#1118)

    * Improved handling of programmer selection

    - Selected programmer is now saved to and loaded from the arduino.json file
    - Arduino.json is monitored for changes, and changing file will update selected programmer & ui
    - Programmer selection UI now shows both the friendly name of the programmer, as well as the arduino name
    - Minor fix to deviceContexts to fire change events after all states are modified
    - Layed groundwork to support querying list of programmers for the current board from arduino toolchain

    * fix dtr on serial open

    * fix dtr on serial open

    * fix linting

    * pre release v0.3.4

    * Add RTS signal on serial open, Add baudrates up to 2000000 (#1142)

    * add buad rates up to 2M

    * add rts signal on serial open and buad rate change

    * add missing space in baud rate array

    * Quick fix for Intellisense (#1144)

    * add hardware tool path

    * intellisense quick fix

    * add hardware tool path

    * intellisense quick fix

    * fix typo

    * pre release v0.3.4-rc2

    * bump to v0.3.4

    * Option to use arduino-cli instead of Arduino IDE (#1017)

    * Hardcoded Arduino-CLI commands for build and upload

    * Added menu checkbox for Arduino CLI

    - Upload with programmer is still not supported
    - Must be created an arduino symlink pointing to arduino-cli

    * If Arduino-CLI, check for arduino-cli instead of arduino.

    Not yet supported on Windows or MacOS

    * Typo

    * Fixed CI requests

    * Fixed CI requests

    * Update src/common/sys/darwin.ts

    MacOS patch for arduino-cli

    Co-authored-by: Marc Lage-Vianna <MarcLV@users.noreply.github.com>

    * Update src/common/sys/win32.ts

    Windows patch for arduino-cli

    Co-authored-by: Marc Lage-Vianna <MarcLV@users.noreply.github.com>

    * Trigger

    * add cli option in commandPath for win32

    * add cli support to board and lib managers

    * rename isArduinoCli to useArduinoCli

    * adds support for uploading using programmer

    * simplify getProgrammer

    * add CLI upload

    * Update src/arduino/arduino.ts

    Co-authored-by: Jason Tranchida <jtranchida@gmail.com>

    * refactor uploadUsingProgrammer

    * fix output path for CLI upload

    * Update package.json

    * update cli option text, thanks @maddogjt

    * update tests

    Co-authored-by: giuliof <giulio@marchtop.localdomain>
    Co-authored-by: Marc Lage-Vianna <MarcLV@users.noreply.github.com>
    Co-authored-by: Adi Azulay <adazulay@microsoft.com>
    Co-authored-by: Adi Azulay <azulayadi@gmail.com>
    Co-authored-by: Jason Tranchida <jtranchida@gmail.com>

    * Improved handling of programmer selection

    - Selected programmer is now saved to and loaded from the arduino.json file
    - Arduino.json is monitored for changes, and changing file will update selected programmer & ui
    - Programmer selection UI now shows both the friendly name of the programmer, as well as the arduino name
    - Minor fix to deviceContexts to fire change events after all states are modified
    - Layed groundwork to support querying list of programmers for the current board from arduino toolchain

    * add cli suppport for programmers

    * add documentation

    Co-authored-by: Marc Goodner <robotdad@users.noreply.github.com>
    Co-authored-by: Adi Azulay <adazulay@microsoft.com>
    Co-authored-by: Giulio <giulio@glgprograms.it>
    Co-authored-by: giuliof <giulio@marchtop.localdomain>
    Co-authored-by: Marc Lage-Vianna <MarcLV@users.noreply.github.com>
    Co-authored-by: Adi Azulay <azulayadi@gmail.com>

commit ae0ebd4
Author: Giulio <giulio@glgprograms.it>
Date:   Tue Dec 8 00:41:05 2020 +0100

    Option to use arduino-cli instead of Arduino IDE (#1017)

    * Hardcoded Arduino-CLI commands for build and upload

    * Added menu checkbox for Arduino CLI

    - Upload with programmer is still not supported
    - Must be created an arduino symlink pointing to arduino-cli

    * If Arduino-CLI, check for arduino-cli instead of arduino.

    Not yet supported on Windows or MacOS

    * Typo

    * Fixed CI requests

    * Fixed CI requests

    * Update src/common/sys/darwin.ts

    MacOS patch for arduino-cli

    Co-authored-by: Marc Lage-Vianna <MarcLV@users.noreply.github.com>

    * Update src/common/sys/win32.ts

    Windows patch for arduino-cli

    Co-authored-by: Marc Lage-Vianna <MarcLV@users.noreply.github.com>

    * Trigger

    * add cli option in commandPath for win32

    * add cli support to board and lib managers

    * rename isArduinoCli to useArduinoCli

    * adds support for uploading using programmer

    * simplify getProgrammer

    * add CLI upload

    * Update src/arduino/arduino.ts

    Co-authored-by: Jason Tranchida <jtranchida@gmail.com>

    * refactor uploadUsingProgrammer

    * fix output path for CLI upload

    * Update package.json

    * update cli option text, thanks @maddogjt

    * update tests

    Co-authored-by: giuliof <giulio@marchtop.localdomain>
    Co-authored-by: Marc Lage-Vianna <MarcLV@users.noreply.github.com>
    Co-authored-by: Adi Azulay <adazulay@microsoft.com>
    Co-authored-by: Adi Azulay <azulayadi@gmail.com>
    Co-authored-by: Jason Tranchida <jtranchida@gmail.com>
  • Loading branch information
adiazulay committed Mar 22, 2021
1 parent e97bad8 commit 3bb7b14
Show file tree
Hide file tree
Showing 43 changed files with 2,409 additions and 925 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Change Log
All notable changes to this project will be documented in this file.

## Version 0.4.0

### Added
- Support for Arduino CLI (#1017)

### Changed
- Autogenerate c_cpp_properties.json with all complier arguments and libraries for IntelliSense (#1183)
- Detects available programmers for selected board (#1118)

### Fixed
- Typos

### Breaking Changes
- Unifies all build commands under a single

### Known Issues
- Arduino CLI doesn't work on Mac (#1205)

## Version 0.3.5

- Release date: November 22, 2020
Expand Down
86 changes: 81 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@ Welcome to the Visual Studio Code extension for **Arduino** <sup>preview</sup> !
* Integrated Arduino Debugging <sup>New</sup>

## Prerequisites
The Arduino IDE is required. Please install it from the [download page](https://www.arduino.cc/en/main/software#download).
Either the Arduino IDE or Arduino CLI are required.

### Arduino IDE
The Arduino IDE can be installed the Arduino [download page](https://www.arduino.cc/en/main/software#download).
- The supported Arduino IDE versions are `1.6.x` and later.
- The Windows Store's version of the Arduino IDE is not supported because of the sandbox environment that the application runs in.
- *Note:* Arduino IDE `1.8.7` has some breaking changes, causing board package and library installation failures.

### Arduino CLI
The Arduino CLI can be downloaded from the repository's [release page](https://github.com/arduino/arduino-cli/releases/tag/0.13.0)
- The extension has only been tested with v0.13.0.
- If you use the CLI you will have to set `arduino.path` since the CLI does not have a defualt path.

## Installation
Open VS Code and press <kbd>F1</kbd> or <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> to open command palette, select **Install Extension** and type `vscode-arduino`.

Expand Down Expand Up @@ -48,12 +56,16 @@ This extension provides several commands in the Command Palette (<kbd>F1</kbd> o
- **Arduino: Select Serial Port**: Change the current serial port.
- **Arduino: Send Text to Serial Port**: Send a line of text via the current serial port.
- **Arduino: Upload**: Build sketch and upload to Arduino board.
- **Arduino: CLI Upload**: Upload complied code without building sketch (CLI only).
- **Arduino: Upload Using Programmer**: Upload using an external programmer.
- **Arduino: CLI Upload Using Programmer**: Upload using an external programmer without building sketch (CLI only).
- **Arduino: Verify**: Build sketch.
- **Arduino: Rebuild IntelliSense Configuration**: Forced/manual rebuild of the IntelliSense configuration. The extension analyzes Arduino's build output and sets the Intellisense include paths, defines, compiler arguments accordingly.

## Keybindings
- **Arduino: Upload** <kbd>Alt</kbd> + <kbd>Cmd</kbd> + <kbd>U</kbd> *or* <kbd>Alt</kbd> + <kbd>Ctrl</kbd> + <kbd>U</kbd>
- **Arduino: Verify** <kbd>Alt</kbd> + <kbd>Cmd</kbd> + <kbd>R</kbd> *or* <kbd>Alt</kbd> + <kbd>Ctrl</kbd> + <kbd>R</kbd>
- **Arduino: Rebuild IntelliSense Configuration** <kbd>Alt</kbd> + <kbd>Cmd</kbd> + <kbd>I</kbd> *or* <kbd>Alt</kbd> + <kbd>Ctrl</kbd> + <kbd>I</kbd>

## Options
| Option | Description |
Expand All @@ -62,11 +74,12 @@ This extension provides several commands in the Command Palette (<kbd>F1</kbd> o
| `arduino.commandPath` | Path to an executable (or script) relative to `arduino.path`. The default value is `arduino_debug.exe` for windows,`Contents/MacOS/Arduino` for Mac and `arduino` for Linux, You also can use a custom launch script to run Arduino by modifying this setting. (Requires a restart after change) Example: `run-arduino.bat` for Windows, `Contents/MacOS/run-arduino.sh` for Mac and `bin/run-arduino.sh` for Linux. |
| `arduino.additionalUrls` | Additional Boards Manager URLs for 3rd party packages. You can have multiple URLs in one string with a comma(`,`) as separator, or have a string array. The default value is empty. |
| `arduino.logLevel` | CLI output log level. Could be info or verbose. The default value is `"info"`. |
| `arduino.allowPDEFiletype` | Allow the VSCode Arduino extension to open .pde files from pre-1.0.0 versions of Ardiuno. Note that this will break Processing code. Default value is `false`. |
| `arduino.allowPDEFiletype` | Allow the VSCode Arduino extension to open .pde files from pre-1.0.0 versions of Ardiuno. Note that this will break Processing code. Default value is `false`. |
| `arduino.enableUSBDetection` | Enable/disable USB detection from the VSCode Arduino extension. The default value is `true`. When your device is plugged in to your computer, it will pop up a message "`Detected board ****, Would you like to switch to this board type`". After clicking the `Yes` button, it will automatically detect which serial port (COM) is connected a USB device. If your device does not support this feature, please provide us with the PID/VID of your device; the code format is defined in `misc/usbmapping.json`.To learn more about how to list the vid/pid, use the following tools: https://github.com/EmergingTechnologyAdvisors/node-serialport `npm install -g serialport` `serialport-list -f jsonline`|
| `arduino.disableTestingOpen` | Enable/disable automatic sending of a test message to the serial port for checking the open status. The default value is `false` (a test message will be sent). |
| `arduino.skipHeaderProvider` | Enable/disable the extension providing completion items for headers. This functionality is included in newer versions of the C++ extension. The default value is `false`.|
| `arduino.defaultBaudRate` | Default baud rate for the serial port monitor. The default value is 115200. Supported values are 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 74880, 115200, 230400 and 250000 |
| `arduino.disableIntelliSenseAutoGen` | When `true` vscode-arduino will not auto-generate an IntelliSense configuration (i.e. `.vscode/c_cpp_properties.json`) by analyzing Arduino's compiler output. |

The following Visual Studio Code settings are available for the Arduino extension. These can be set in global user preferences <kbd>Ctrl</kbd> + <kbd>,</kbd> or workspace settings (`.vscode/settings.json`). The latter overrides the former.

Expand All @@ -75,7 +88,7 @@ The following Visual Studio Code settings are available for the Arduino extensio
"arduino.path": "C:/Program Files (x86)/Arduino",
"arduino.commandPath": "arduino_debug.exe",
"arduino.logLevel": "info",
"arduino.allowPDEFiletype": false,
"arduino.allowPDEFiletype": false,
"arduino.enableUSBDetection": true,
"arduino.disableTestingOpen": false,
"arduino.skipHeaderProvider": false,
Expand All @@ -98,15 +111,78 @@ The following settings are as per sketch settings of the Arduino extension. You
"board": "adafruit:samd:adafruit_feather_m0",
"output": "../build",
"debugger": "jlink",
"prebuild": "bash prebuild.sh"
"prebuild": "./prebuild.sh",
"postbuild": "./postbuild.sh",
"intelliSenseGen": "global"
}
```
- `sketch` - The main sketch file name of Arduino.
- `port` - Name of the serial port connected to the device. Can be set by the `Arduino: Select Serial Port` command. For Mac users could be "/dev/cu.wchusbserial1420".
- `board` - Currently selected Arduino board alias. Can be set by the `Arduino: Change Board Type` command. Also, you can find the board list there.
- `output` - Arduino build output path. If not set, Arduino will create a new temporary output folder each time, which means it cannot reuse the intermediate result of the previous build leading to long verify/upload time, so it is recommended to set the field. Arduino requires that the output path should not be the workspace itself or in a subfolder of the workspace, otherwise, it may not work correctly. By default, this option is not set. It's worth noting that the contents of this file could be deleted during the build process, so pick (or create) a directory that will not store files you want to keep.
- `debugger` - The short name of the debugger that will be used when the board itself does not have a debugger and there is more than one debugger available. You can find the list of debuggers [here](https://github.com/Microsoft/vscode-arduino/blob/master/misc/debuggerUsbMapping.json). By default, this option is not set.
- `prebuild` - External command before building the sketch file. You should only set one `prebuild` command. `command1 && command2` does not work. If you need to run multiple commands before the build, then create a script.
- `prebuild` - External command which will be invoked before any sketch build (verify, upload, ...). For details see the [Pre- and Post-Build Commands](#Pre--and-Post-Build-Commands) section.
- `postbuild` - External command to be run after the sketch has been built successfully. See the afore mentioned section for more details.
- `intelliSenseGen` - Override the global setting for auto-generation of the IntelliSense configuration (i.e. `.vscode/c_cpp_properties.json`). Three options are available:
- `"global"`: Use the global settings (default)
- `"disable"`: Disable the auto-generation even if globally enabled
- `"enable"`: Enable the auto-generation even if globally disabled
- `buildPreferences` - Set Arduino preferences which then are used during any build (verify, upload, ...). This allows for extra defines, compiler options or includes. The preference key-value pairs must be set as follows:
```json
"buildPreferences": [
["build.extra_flags", "-DMY_DEFINE=666 -DANOTHER_DEFINE=3.14 -Wall"],
["compiler.cpp.extra_flags", "-DYET_ANOTER=\"hello\""]
]
}
```

## Pre- and Post-Build Commands
On Windows the commands run within a `cmd`-, on Linux and OSX within a `bash`-instance. Therefore your command can be anything what you can run within those shells. Instead of running a command you can invoke a script. This makes writing more complex pre-/post-build mechanisms much easier and opens up the possibility to run python or other scripting languages.
The commands run within the workspace root directory and vscode-arduino sets the following environment variables:
**`VSCA_BUILD_MODE`** The current build mode, one of `Verifying`, `Uploading`, `Uploading (programmer)` or `Analyzing`. This allows you to run your script on certain build modes only.
**`VSCA_SKETCH`** The sketch file relative to your workspace root directory.
**`VSCA_BOARD`** Your board and configuration, e.g. `arduino:avr:nano:cpu=atmega328`.
**`VSCA_WORKSPACE_DIR`** The absolute path of your workspace root directory.
**`VSCA_LOG_LEVEL`** The current log level. This allows you to control the verbosity of your scripts.
**`VSCA_SERIAL`** The serial port used for uploading. Not set if you haven't set one in your `arduino.json`.
**`VSCA_BUILD_DIR`** The build directory. Not set if you haven't set one in your `arduino.json`.

For example under Windows the following `arduino.json` setup
```json
{
"board": "arduino:avr:nano",
"sketch": "test.ino",
"configuration": "cpu=atmega328",
"prebuild": "IF \"%VSCA_BUILD_MODE%\"==\"Verifying\" (echo VSCA_BUILD_MODE=%VSCA_BUILD_MODE% && echo VSCA_BOARD=%VSCA_BOARD%)"
}
```
will produce
```
[Starting] Verifying sketch 'test.ino'
Running pre-build command: "IF "%VSCA_BUILD_MODE%"=="Verifying" (echo VSCA_BUILD_MODE=%VSCA_BUILD_MODE% && echo VSCA_BOARD=%VSCA_BOARD%)"
VSCA_BUILD_MODE=Verifying
VSCA_BOARD=arduino:avr:nano:cpu=atmega328
Loading configuration...
<...>
```
when verifying.

## IntelliSense
vscode-arduino auto-configures IntelliSense by default. vscode-arduino analyzes Arduino's compiler output by running a separate build and generates the corresponding configuration file at `.vscode/c_cpp_properties.json`. vscode-arduino tries as hard as possible to keep things up to date, e.g. it runs the analysis when switching the board or the sketch.

It doesn't makes sense though to run the analysis repeatedly. Therefore if the workspace reports problems ("squiggles") - for instance after adding new includes from a new library - run the analysis manually:

Manual rebuild: **Arduino: Rebuild IntelliSense Configuration**,
Keybindings: <kbd>Alt</kbd> + <kbd>Cmd</kbd> + <kbd>I</kbd> *or* <kbd>Alt</kbd> + <kbd>Ctrl</kbd> + <kbd>I</kbd>

When the analysis is invoked manually it ignores any global and project specific disable.

### IntelliSense Configurations
vscode-arduino's analysis stores the result as a dedicated IntelliSense-configuration named `Arduino`. You have to select it from the far right of the status bar when you're in one of your source files as shown here:

![74001156-cfce8280-496a-11ea-9b9d-7d30c83765c1](https://user-images.githubusercontent.com/21954933/74351237-2696ea80-4db7-11ea-9f7a-1bfc652ad5f5.png)

This system allows you to setup and use own IntelliSense configurations in parallel to the automatically generated configurations provided through vscode-arduino. Just add your configuration to `c_cpp_properties.json` and name it differently from the default configuration (`Arduino`), e.g. `My awesome configuration` and select it from the status bar or via the command palette command **C/C++: Select a Configuration...**

## Debugging Arduino Code <sup>preview</sup>
Before you start to debug your Arduino code, please read [this document](https://code.visualstudio.com/docs/editor/debugging) to learn about the basic mechanisms of debugging in Visual Studio Code. Also see [debugging for C++ in VSCode](https://code.visualstudio.com/docs/languages/cpp#_debugging) for further reference.
Expand Down
29 changes: 28 additions & 1 deletion ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Visual Studio Code Extension for Arduino incorporates third party material from
18. vscode-extension-telemetry (https://github.com/Microsoft/vscode-extension-telemetry)
19. winreg (https://github.com/fresc81/node-winreg)
20. Winston (https://github.com/winstonjs/winston)

21. cocopa (https://github.com/elektronikworkshop/cocopa)

%% body-parser NOTICES, INFORMATION, AND LICENSE BEGIN HERE
=========================================
Expand Down Expand Up @@ -532,4 +532,31 @@ THE SOFTWARE.
=========================================
END OF Winston NOTICES, INFORMATION, AND LICENSE

%% cocopa NOTICES, INFORMATION, AND LICENSE BEGIN HERE
=========================================
Copyright (C) 2020 Uli Franke - Elektronik Workshop

All rights reserved.

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
=========================================
END OF cocopa NOTICES, INFORMATION, AND LICENSE

34 changes: 33 additions & 1 deletion misc/arduinoValidator.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,38 @@
"description": "Arduino Debugger Settings",
"type": "string",
"minLength": 1
},
"intelliSenseGen": {
"description": "Disable/enable the automatic generation of the IntelliSense configuration file (c_cpp_properties.json) for this project (overrides the global setting). When set to \"global\" the global extension settings will be used.",
"type": "string",
"default": "global",
"enum": [
"global",
"disable",
"enable"
]
},
"prebuild": {
"description": "Command to be run before every build",
"type": "string",
"minLength": 1
},
"postbuild": {
"description": "Command to be run after every build",
"type": "string",
"minLength": 1
},
"buildPreferences": {
"description": "Arduino preferences which are passed to the Arduino back-end during build",
"type": "array",
"items": {
"type":"array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "string"
}
}
}
}
}
}
Loading

0 comments on commit 3bb7b14

Please sign in to comment.