From e317d3472e00c20fba3bf79aec772c71f31ff3b9 Mon Sep 17 00:00:00 2001 From: Adi Azulay Date: Tue, 20 Apr 2021 08:14:56 -0700 Subject: [PATCH 1/2] Bump to v0.4.1 (#1239) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 * Update src/common/sys/win32.ts Windows patch for arduino-cli Co-authored-by: Marc Lage-Vianna * 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 * refactor uploadUsingProgrammer * fix output path for CLI upload * Update package.json * update cli option text, thanks @maddogjt * update tests Co-authored-by: giuliof Co-authored-by: Marc Lage-Vianna Co-authored-by: Adi Azulay Co-authored-by: Adi Azulay Co-authored-by: Jason Tranchida * 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 * Update src/common/sys/win32.ts Windows patch for arduino-cli Co-authored-by: Marc Lage-Vianna * 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 * refactor uploadUsingProgrammer * fix output path for CLI upload * Update package.json * update cli option text, thanks @maddogjt * update tests Co-authored-by: giuliof Co-authored-by: Marc Lage-Vianna Co-authored-by: Adi Azulay Co-authored-by: Adi Azulay Co-authored-by: Jason Tranchida * 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 Co-authored-by: Adi Azulay Co-authored-by: Giulio Co-authored-by: giuliof Co-authored-by: Marc Lage-Vianna Co-authored-by: Adi Azulay * Fixed misspelled function name * Fixed spelling. * Fix @property * Add missing return values * Removed unused import * Branch for the implementation of the automagical IntelliSense configuration * Update documentation * More documentation on this project * Tried to identify most of the tasks * Added beer money support option * More documentation update * More investigations and documentation, especially on intrinsic/built-in compiler header include paths * 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 * Improved line splitting of built-in include parser after commenting on a pull request :) * 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 * Documentation updates * Notes regarding settings * Notes where to run the auto-generation * 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 * Added two more TODOs to branch documentation * Added even more TODOs to branch documentation * Moved TODO in branch documentation * Documenting ... * Moved compiler parser to cocopa package for better testability and maintainability * Updated earned :beers: * Added IntelliSense setup auto-generation project (sketch-context) configuration flag which can override the global flag * Try to generate IntelliSense configuration even when the compilation fails * Incorporated the latest progress from cocopa development * Fix issue 771 * Fixes the line splitting regex as outlined in https://github.com/microsoft/vscode-arduino/pull/771 * Removed a redundand condition * Fix regression and improve regex matching * Fixed regression introduced with adaptions to latest version of cocopa * Made compile command regex match more stringent * Notes about serial monitor * Added more serial monitor ideas from [John Lonergan](https://github.com/microsoft/vscode-arduino/issues/463#issuecomment-583853833) * Added some ideas how to implement a better serial monitor * Moved arduino specifics from cocopa to vscode-arduino * 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. * Minor documentation rub * Moved intellisense function to a separate file * Added instructions how to run development code * More on beta testing, added link to chat room * Note how to run vscode without having gulp on your user path * Updated beer money log * Updated branch notes -- documented changes not committed though. * Rename Logger to logger * Rename verifyResult to success * Move args variable till top of upload, uploadUsingProgrammer and verify * Introduce verbose variable * Unify util.spawn invocation * Unify exit error message * Add cleanup expression * Add selectSerial expression * Inline and move appPath later * Move arg buildup earlier in functions * Move selectProgrammer down * Spelling correction * Add buildMode argument to upload and uploadUsingProgrammer * Make upload and uploadUsingProgrammer identical * Merge upload and uploadUsingProgrammer into one build function * Add buildMode argument to verify * Add stdoutCallback expression * Rename output to buildDir * Use cocopa and add Analyze build mode * Make build return boolean * Make build and verify identical * Merge build and verify * Add arduino.rebuildIntelliSenseConfig * Fix whitespace * Disabled and marked all previous implementations of IntelliSense support for later removal using `IS-REMOVE` * Updated project log * Don't use hard coded paths when possible. * New classes which will improve the device settings management and event handling. To be integrated with one of the next commits. * Updated log and issues * Added/documented all known related issues * Updated log * Updated and extended status * General brushing of structure and text * Updated project log and status * Updated and completed documentation of the current state within README.md * Updated project log and status * 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 * Updated log and beers. * Added "some" additional issues -- currently I've found 28! * Updated log, status and beers * Removed obsolete doc folder as all this is now part of cocopa * 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. * Updated log and beers * Updated to latest cocopa which features X-platform support and better lexer * IntelliSense config generator * Now normalizes generated include paths * Bumped cocopa to 0.0.9 * Updated log * Updated branch log and beers * 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 * Updated log and beers * 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. * 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 * Reworked util.spawn to mergable version * Added/reviewed some notes * Changed Serial.updatePortListStatus to make use of optional argument to eliminate updatePortListStatus(null) calls * Refined some documentation comment * Updated log * Final pull request dependency style for cocopa * Updated beers * Added link to alpha releases to top of document * Run IntelliSense analysis for every build * Run IntelliSense analysis for every build * Added global enum for log level * Build/analysis logging improvements * Fixed bug in board.ts: Conceptual flaw when checking if configuration option is valid * Fixed exception which occurs if one of the include directories doesn't exists and we try to search it for Arduino.h * 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 * 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 * Collapsing multiple consecutive newlines into a single newline for non verbose build log * IntelliSense auto gen respected global and project specific dis-/enable flags for analyze only. Now these flags have the same effect during regular builds. * 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 * C++ standard is now parsed from compiler arguments Plus: Moved some methods to cocopa and got rid of the typed-promisify dependency * Section which outlines additional features this branch addresses * 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 * 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 * Full cmd support for pre-/post-build commands on Windows Addresses #786 * Documentation for pre-/post-build commands and their environment variables * Updated log, status and beers * 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 * 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 * Add and document buildPreferences setting * Validator for `buildPreferences` * Documentation for `buildPreferences` * 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 * Updated log, additional stuff and beers * Move the _build to the end and make private * Consolidate all boardDescriptor argument pushing * Remove compile argument and expand BuildMode with CliUpload and CliUploadProgrammer * Reverse and merge tests * Replace "upload" with "compile --upload" * Join args.push statements * Remove arrow-head anti-pattern * add support for cli * fix cli analyze mode * fix verbose setting and cli programmer upload * remove redundant prebuild check * update travis * fix missing " * 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 * 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](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Adi Azulay * remove IntelliSense Auto branch notes * remove -MMD from complier args for intellisesne (#1208) * Squashed commit of the following: commit 57c8d2dff5637a9cdcea0c2f0188c22e5a2cce3e Author: Adi Azulay Date: Mon Mar 22 13:00:21 2021 -0700 update changelog commit 6e659974165a65fd5a7fe64c19b20b516e890b39 Author: Adi Azulay Date: Mon Mar 22 12:49:56 2021 -0700 bump to v0.4.0 commit 6d63a018cf2f26dbc6377ab3d38f5a99a5d8544a Author: Adi Azulay Date: Tue Mar 9 08:54:05 2021 -0800 update version commit ed886ad7d8c265643aeb90e172c8b84351baa251 Merge: 6ecfc55 9ca2400 Author: Adi Azulay Date: Mon Mar 8 14:01:55 2021 -0800 Merge branch 'develop' into pre-release-v0.4.0 commit 6ecfc55c3adc6fd484353d95750436de3171e685 Author: Adi Azulay Date: Thu Feb 18 11:27:45 2021 -0800 update version in package commit 11265813085dacc45f02e3ae6bf978620c6bff30 Author: Adi Azulay Date: Thu Feb 18 11:07:59 2021 -0800 update readme commit 5571e5249260c80ecc8cbf8ca6d4d55f0761ae48 Author: Adi Azulay Date: Thu Feb 18 10:52:24 2021 -0800 update package-lock commit 0b60f1fcd9f632f389882b62495865416adf82ca Merge: e044711 e97bad8 Author: Adi Azulay Date: Thu Feb 18 09:59:26 2021 -0800 Merge branch 'master' into pre-release-v0.4.0 commit e97bad8ab8835c433c3d4e1114bf99284c508a4b Author: Adi Azulay Date: Thu Feb 18 09:56:05 2021 -0800 bump to v0.3.5 (#1196) * update usb native * update changelog * fix ref tag for publishing * fix ref tag for publishing * change build to check version env var * fix version spelling * add {} to if in publish * change version check to regex * fix formatting * change to multiline run * add echo for ISPRODUCTION * add missing s to outputs * remove debugging echo commit e044711696797428210b18a67f693af70efdc513 Merge: 739aa95 5f4c400 Author: Adi Azulay 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 739aa956b1ab2bd3d90cd753008496c97ff71176 Author: Adi Azulay Date: Thu Feb 4 14:21:55 2021 -0800 pre release v0.4.0 * Quick pick selection of sketch files (#1128) * Quick pick selection of sketch files - Replace arduino.setSketchFile command with new arduino.selectSketch command which presents the user with a quick select containing all of the sketch files in the workspace. - Add "Arduino: Select Sketch" to the command palette - When picking sketches, filter out hardware, library, and build folders that may be under the workspace * Fix incorrect slash on library exclude pattern Co-authored-by: Adi Azulay * Corrected typo from Ardiuno to Arduino. (#1191) Co-authored-by: Adi Azulay * Fix arduinoPath resolution on MacOS (#1227) * Fix arduinoPath resolution in MacOS. The `resolveMacArduinoAppPath` utility was automatically adding "Arduino.app" to the resolved `arduinoPath` regardless of whether `useAndroidCli` was enabled. This was breaking installations of `arduino-cli` made through Homebrew. The path to the command ends up being either `/usr/local/bin/arduino-cli` or `/opt/homebrew/bin/arduino-cli`. This function would resolve an `arduinoPath` of `/opt/homebrew/bin` to `/opt/homebrew/bin/Arduino.app/arduino-cli`. Co-authored-by: Adi Azulay * Bump y18n from 3.2.1 to 3.2.2 (#1219) Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Adi Azulay * Fix confusion about IDE breaking changes (#1229) Closed issue #994 (and presumably others) indicate that the confusing version text referring to 1.8.7 will be corrected, but that never happened. This PR attempts to improve the text to correct the issue. Co-authored-by: Adi Azulay * Fix typos in CHANGELOG.md (#1226) Co-authored-by: Adi Azulay * Fix typos in README.md (#1225) Co-authored-by: Adi Azulay * Bump y18n from 4.0.0 to 4.0.1 in /src/views (#1220) Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1. - [Release notes](https://github.com/yargs/y18n/releases) - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md) - [Commits](https://github.com/yargs/y18n/commits) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Adi Azulay * Bump elliptic from 6.5.3 to 6.5.4 (#1212) Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Adi Azulay * Bump elliptic from 6.5.3 to 6.5.4 in /src/views (#1210) Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Adi Azulay * add usbcon macro to config (#1231) * add ai key to deploy (#1236) * Bump to v0.4.1 (#1238) * pre-release v0.4.1-rc1 * pre-release v0.4.1-rc2 * update version * bump to v0.4.1 Co-authored-by: Giulio Co-authored-by: giuliof Co-authored-by: Marc Lage-Vianna Co-authored-by: Jason Tranchida Co-authored-by: Marc Goodner Co-authored-by: Uli Franke Co-authored-by: Håkon Løvdal Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cameron Bielstein Co-authored-by: Adam Michel Co-authored-by: mikebaz Co-authored-by: jogo- --- .github/workflows/build.yml | 8 ++-- CHANGELOG.md | 44 ++++++++++++------- README.md | 10 ++--- gulpfile.js | 18 ++------ package-lock.json | 56 +++++++++++++----------- package.json | 7 ++- src/arduino/arduinoSettings.ts | 8 ++-- src/arduino/intellisense.ts | 3 ++ src/common/sys/darwin.ts | 79 +++++++++++++++++----------------- src/common/util.ts | 4 +- src/deviceContext.ts | 2 +- src/extension.ts | 40 +++++++++++------ src/views/package-lock.json | 36 +++++++--------- test/extension.test.ts | 2 +- 14 files changed, 172 insertions(+), 145 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47a37649..7ab473b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,6 @@ jobs: - name: scripts run: | gulp tslint - gulp genAikey vsce package - name: run tests if: ${{ matrix.os != 'windows-latest' }} @@ -93,7 +92,6 @@ jobs: - name: scripts run: | gulp tslint - gulp genAikey vsce package - name: upload .vsix to github tag uses: svenstaro/upload-release-action@v2 @@ -111,4 +109,8 @@ jobs: fi - name: publish if: steps.check-version.outputs.ISPRODUCTION == 'true' - run: vsce publish -p ${{ secrets.VSCE_TOKEN }} + env: + PROD_AIKEY: ${{ secrets.PROD_AIKEY }} + run: | + gulp genAikey + vsce publish -p ${{ secrets.VSCE_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index a0529ebd..913605a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,26 @@ # Change Log All notable changes to this project will be documented in this file. +## Version 0.4.1 + +### Added +- Quickpick sketch selection [#1128](https://github.com/microsoft/vscode-arduino/pull/1128) Thanks [@maddogjt](https://github.com/maddogjt) + +### Fixed +- Arduino CLI on MacOS [#1221](https://github.com/microsoft/vscode-arduino/issues/1221) Thanks [@awmichel](https://github.com/awmichel) +- Typos [#1226](https://github.com/microsoft/vscode-arduino/pull/1226), [#1225](https://github.com/microsoft/vscode-arduino/pull/1225), [#1191](https://github.com/microsoft/vscode-arduino/pull/1191) Thanks [@jogo-](https://github.com/jogo-) [@CBielstein](https://github.com/CBielstein) +- add USBCON back into IntelliSense config [#1216](https://github.com/microsoft/vscode-arduino/issues/1216) +- Update depedencies +- App Insights key in Actions [#1236](https://github.com/microsoft/vscode-arduino/pull/1236) + ## Version 0.4.0 ### Added -- Support for Arduino CLI (#1017) +- 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) +- Autogenerate c_cpp_properties.json with all complier arguments and libraries for IntelliSense #1183 +- Detects available programmers for selected board #1118 ### Fixed - Typos @@ -17,7 +29,7 @@ All notable changes to this project will be documented in this file. - Unifies all build commands under a single ### Known Issues -- Arduino CLI doesn't work on Mac (#1205) +- Arduino CLI doesn't work on Mac [#1205](https://github.com/microsoft/vscode-arduino/issues/1205) ## Version 0.3.5 @@ -31,8 +43,8 @@ All notable changes to this project will be documented in this file. - Release date: November 22, 2020 ### Changed -- Add DTR and RTS signals on serial open and buad rate change -- Improves c_cpp_properties.json autogeneration for intelliSense +- Add DTR and RTS signals on serial open and baud rate change +- Improves c_cpp_properties.json autogeneration for IntelliSense ## Version 0.3.3 @@ -69,7 +81,7 @@ All notable changes to this project will be documented in this file. - Fix issue of "Fail to debug on Ubuntu". [[#933](https://github.com/microsoft/vscode-arduino/issues/933)] - Remove line ending selection. Fix the issue of "Save the last used end of line". [[#952](https://github.com/microsoft/vscode-arduino/issues/952)] - Fix the issue of "Can't install libraries from VS Code for ESP8266". [[#930](https://github.com/microsoft/vscode-arduino/issues/930)] -- Fix the issue of "Project path can not be changed". [[#978](https://github.com/microsoft/vscode-arduino/issues/978)] +- Fix the issue of "Project path cannot be changed". [[#978](https://github.com/microsoft/vscode-arduino/issues/978)] Special thanks to [raomin](https://github.com/raomin), thanks for your contributions and feedbacks. @@ -82,7 +94,7 @@ Special thanks to [raomin](https://github.com/raomin), thanks for your contribut ## Version 0.2.28 -- Release data: November 15, 2019 +- Release date: November 15, 2019 ### Fixed @@ -158,7 +170,7 @@ Special thanks to [Deqing Sun](https://github.com/DeqingSun), thank you for your - Add sketches folder into examples view [#652](https://github.com/Microsoft/vscode-arduino/issues/652) ### Changed -- Change Arduino langauge ID to C++ [#686](https://github.com/Microsoft/vscode-arduino/issues/686) +- Change Arduino language ID to C++ [#686](https://github.com/Microsoft/vscode-arduino/issues/686) - Use VS Code new webview API [#701](https://github.com/Microsoft/vscode-arduino/issues/701) ### Fixed @@ -181,7 +193,7 @@ Special thanks to [Deqing Sun](https://github.com/DeqingSun), [Takashi Matsuoka] - Fix the output path not exist issue [#641](https://github.com/Microsoft/vscode-arduino/issues/641) - Update arduino.path instruction [#635](https://github.com/Microsoft/vscode-arduino/issues/635) -Special thanks to [aster94](https://github.com/aster94), [Niels van der Veer](https://github.com/n9iels), [AntoineGirafe](https://github.com/AntoineGirafe), thank you foryour contributions and feedbacks. +Special thanks to [aster94](https://github.com/aster94), [Niels van der Veer](https://github.com/n9iels), [AntoineGirafe](https://github.com/AntoineGirafe), thank you for your contributions and feedbacks. ## Version 0.2.20 @@ -206,7 +218,7 @@ Special thanks to [aster94](https://github.com/aster94), [Niels van der Veer](ht - Add Wio 3G board and WeMos D1 board [#223](https://github.com/Microsoft/vscode-arduino/pull/223) ### Fixed -- Fix intellisense issue of `c_cpp_properties.json` +- Fix IntelliSense issue of `c_cpp_properties.json` - Fix "Verifying" is misspelled issue [#591](https://github.com/Microsoft/vscode-arduino/issues/591) - Improve config setting descriptions [#605](https://github.com/Microsoft/vscode-arduino/issues/605) @@ -241,13 +253,13 @@ Special thanks to [Thad House](https://github.com/ThadHouse), [Carlos Gomez](htt ### Added - Add a sketch file button in status bar to reset sketch file [#481](https://github.com/Microsoft/vscode-arduino/issues/481) - Add loading status bar for verify and build command [#137](https://github.com/Microsoft/vscode-arduino/issues/137) -- Add `prebuild` support in `arduio.json` [#411](https://github.com/Microsoft/vscode-arduino/issues/411) +- Add `prebuild` support in `arduino.json` [#411](https://github.com/Microsoft/vscode-arduino/issues/411) - Add upload using programmer command [#407](https://github.com/Microsoft/vscode-arduino/issues/407) - Add ignore option for board detection notification [#495](https://github.com/Microsoft/vscode-arduino/issues/495) - Add settings for disable/enable serial monitor TestingOpen [#530](https://github.com/Microsoft/vscode-arduino/issues/530) ### Fixed -- Fix intellisense issue of `c_cpp_properties.json` (preview) [#438](https://github.com/Microsoft/vscode-arduino/issues/438) +- Fix IntelliSense issue of `c_cpp_properties.json` (preview) [#438](https://github.com/Microsoft/vscode-arduino/issues/438) Special thanks to [Joel Santos](https://github.com/mundodisco8), [John](https://github.com/VashJuan), [mybayern1974](https://github.com/mybayern1974), [Maxime Paquatte](https://github.com/maxime-paquatte), [Joe Saavedra](https://github.com/jmsaavedra), [Kye Burchard](https://github.com/kyeb), [Laurent Haas - F6FVY](https://github.com/f6fvy), thank you for your feedbacks. @@ -337,7 +349,7 @@ Special thanks to [GarethE](https://github.com/keyoke), thank you for your contr - Contribution from [DeqingSun](https://github.com/DeqingSun): Add board support for STM32F1 with Arudino_STM32 [#377](https://github.com/Microsoft/vscode-arduino/pull/377) ### Changed -- Leverage the ouput path config to speedup upload/verify +- Leverage the output path config to speedup upload/verify - Fix USB detection issue during uploading [#371](https://github.com/Microsoft/vscode-arduino/pull/371), [372](https://github.com/Microsoft/vscode-arduino/pull/372) - Contribution from [lialosiu](https://github.com/lialosiu): Fix encoding issue for non UTF-8 [#364](https://github.com/Microsoft/vscode-arduino/pull/364) - Update the documents with the helps of @@ -361,7 +373,7 @@ Special thanks to [GarethE](https://github.com/keyoke), thank you for your contr ### Changed - Use a new configuration page for switching arduino boards -- Lazy load the arduino extension on start up, only usb detection works in background, when it detects an arduino board, the extension will fully activate +- Lazy load the arduino extension on startup, only usb detection works in background, when it detects an arduino board, the extension will fully activate - Update unit test to some basic arduino commands - Fix some typos in code - Fix issue #289 #324 #327 @@ -432,4 +444,4 @@ Special thanks to [GarethE](https://github.com/keyoke), thank you for your contr - Built-in serial monitor - Snippets for sketches - Automatic Arduino project scaffolding -- Commond Palette (F1) integration of frequently used commands (e.g. Verify, Upload...) +- Command Palette (F1) integration of frequently used commands (e.g. Verify, Upload...) diff --git a/README.md b/README.md index 3bc3adff..3935ca40 100644 --- a/README.md +++ b/README.md @@ -22,12 +22,12 @@ Either the Arduino IDE or Arduino CLI are required. 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. +- *Note:* Arduino IDE `1.8.7` had some breaking changes, causing board package and library installation failures. These failures were corrected in `1.8.8` and later. ### 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. +- If you use the CLI you will have to set `arduino.path` since the CLI does not have a default path. ## Installation Open VS Code and press F1 or Ctrl + Shift + P to open command palette, select **Install Extension** and type `vscode-arduino`. @@ -60,7 +60,7 @@ This extension provides several commands in the Command Palette (F1 o - **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. +- **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** Alt + Cmd + U *or* Alt + Ctrl + U @@ -71,10 +71,10 @@ This extension provides several commands in the Command Palette (F1 o | Option | Description | | --- | --- | | `arduino.path` | Path to Arduino, you can use a custom version of Arduino by modifying this setting to include the full path. Example: `C:\\Program Files\\Arduino` for Windows, `/Applications` for Mac, `/home//Downloads/arduino-1.8.1` for Linux. (Requires a restart after change). The default value is automatically detected from your Arduino IDE installation path. | -| `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.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 Arduino. 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`.| diff --git a/gulpfile.js b/gulpfile.js index 7888a888..a8955511 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -81,20 +81,10 @@ gulp.task("clean", (done) => { }); gulp.task("genAikey", (done) => { - if (process.env.TRAVIS_TAG) { - const ISPROD = /^v?[0-9]+\.[0-9]+\.[0-9]+$/.test(process.env.TRAVIS_TAG || ""); - const packageJson = JSON.parse(fs.readFileSync("package.json")); - if (ISPROD) { - packageJson.aiKey = process.env["PROD_AIKEY"]; - } else { - packageJson.aiKey = process.env["INT_AIKEY"] || packageJson.aiKey; - } - fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2) + "\n"); - done(); - } else { - log("Skipping genAiKey"); - done(); - } + const packageJson = JSON.parse(fs.readFileSync("package.json")); + packageJson.aiKey = process.env.PROD_AIKEY; + fs.writeFileSync("package.json", JSON.stringify(packageJson, null, 2) + "\n"); + done(); }); gulp.task("test", (done) => { diff --git a/package-lock.json b/package-lock.json index 50043aaa..4354db20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vscode-arduino", - "version": "0.4.0", + "version": "0.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1332,9 +1332,9 @@ } }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yallist": { @@ -2210,24 +2210,30 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "dev": true, "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" }, "dependencies": { "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true } } @@ -6223,9 +6229,9 @@ } }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yargs": { @@ -9315,9 +9321,9 @@ "dev": true }, "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.2.tgz", + "integrity": "sha512-uGZHXkHnhF0XeeAPgnKfPv1bgKAYyVvmNL1xlKsPYZPaIHxGti2hHqvOCQv71XMsLxu1QjergkqogUnms5D3YQ==", "dev": true }, "yargs": { @@ -9574,9 +9580,9 @@ } }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yargs": { diff --git a/package.json b/package.json index a97d952f..d049cf7a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-arduino", "displayName": "Arduino", "description": "Arduino for Visual Studio Code", - "version": "0.4.0", + "version": "0.4.1", "publisher": "vsciot-vscode", "aiKey": "83dd2c27-6594-41d3-85a9-bdb22070eb42", "preview": true, @@ -42,6 +42,7 @@ "onCommand:arduino.rebuildIntelliSenseConfig", "onCommand:arduino.selectProgrammer", "onCommand:arduino.selectSerialPort", + "onCommand:arduino.selectSketch", "onCommand:arduino.changeBaudRate", "onCommand:arduino.openSerialMonitor", "onCommand:arduino.sendMessageToSerialPort", @@ -115,6 +116,10 @@ "command": "arduino.selectProgrammer", "title": "Arduino: Select Programmer" }, + { + "command": "arduino.selectSketch", + "title": "Arduino: Select Sketch" + }, { "command": "arduino.selectSerialPort", "title": "Arduino: Select Serial Port" diff --git a/src/arduino/arduinoSettings.ts b/src/arduino/arduinoSettings.ts index 8d994d81..0e4a01cb 100644 --- a/src/arduino/arduinoSettings.ts +++ b/src/arduino/arduinoSettings.ts @@ -104,7 +104,7 @@ export class ArduinoSettings implements IArduinoSettings { public get defaultExamplePath(): string { if (os.platform() === "darwin") { - return path.join(util.resolveMacArduinoAppPath(this._arduinoPath), "/Contents/Java/examples"); + return path.join(util.resolveMacArduinoAppPath(this._arduinoPath, this._useArduinoCli), "/Contents/Java/examples"); } else { return path.join(this._arduinoPath, "examples"); } @@ -116,7 +116,7 @@ export class ArduinoSettings implements IArduinoSettings { public get defaultPackagePath(): string { if (os.platform() === "darwin") { - return path.join(util.resolveMacArduinoAppPath(this._arduinoPath), "/Contents/Java/hardware"); + return path.join(util.resolveMacArduinoAppPath(this._arduinoPath, this._useArduinoCli), "/Contents/Java/hardware"); } else { // linux and win32. return path.join(this._arduinoPath, "hardware"); } @@ -124,7 +124,7 @@ export class ArduinoSettings implements IArduinoSettings { public get defaultLibPath(): string { if (os.platform() === "darwin") { - return path.join(util.resolveMacArduinoAppPath(this._arduinoPath), "/Contents/Java/libraries"); + return path.join(util.resolveMacArduinoAppPath(this._arduinoPath, this._useArduinoCli), "/Contents/Java/libraries"); } else { // linux and win32 return path.join(this._arduinoPath, "libraries"); } @@ -133,7 +133,7 @@ export class ArduinoSettings implements IArduinoSettings { public get commandPath(): string { const platform = os.platform(); if (platform === "darwin") { - return path.join(util.resolveMacArduinoAppPath(this._arduinoPath), path.normalize(this._commandPath)); + return path.join(util.resolveMacArduinoAppPath(this._arduinoPath, this._useArduinoCli), path.normalize(this._commandPath)); } else { return path.join(this._arduinoPath, path.normalize(this._commandPath)); } diff --git a/src/arduino/intellisense.ts b/src/arduino/intellisense.ts index 56daeea7..1458cedd 100644 --- a/src/arduino/intellisense.ts +++ b/src/arduino/intellisense.ts @@ -101,6 +101,9 @@ export function makeCompilerParserContext(dc: DeviceContext): ICoCoPaContext { runner.result.options.splice(mmdIndex); } + // Add USB Connected marco to defines + runner.result.defines.push("USBCON") + try { const cmd = os.platform() === "darwin" ? "Cmd" : "Ctrl"; diff --git a/src/common/sys/darwin.ts b/src/common/sys/darwin.ts index 4d5c7e98..f17cfd94 100644 --- a/src/common/sys/darwin.ts +++ b/src/common/sys/darwin.ts @@ -1,40 +1,39 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. - -import * as childProcess from "child_process"; -import * as path from "path"; -import { directoryExistsSync, fileExistsSync, resolveMacArduinoAppPath } from "../util"; - -export function resolveArduinoPath(): string { - let result; - - const defaultCommonPaths = [path.join(process.env.HOME, "Applications"), "/Applications"]; - for (const scanPath of defaultCommonPaths) { - if (directoryExistsSync(path.join(scanPath, "Arduino.app"))) { - result = scanPath; - break; - } - } - return result || ""; -} - -export function validateArduinoPath(arduinoPath: string, useArduinoCli = false): boolean { - return fileExistsSync(path.join(resolveMacArduinoAppPath(arduinoPath), useArduinoCli ? "arduino-cli" : "/Contents/MacOS/Arduino")); - -} - -export function findFile(fileName: string, cwd: string): string { - let pathString; - try { - pathString = childProcess.execSync(`find ${cwd} -name ${fileName} -type f`, { encoding: "utf8" }).split("\n"); - - if (pathString && pathString[0] && fileExistsSync(pathString[0].trim())) { - pathString = path.normalize(pathString[0].trim()); - } else { - pathString = null; - } - } catch (ex) { - // Ignore the errors. - } - return pathString; -} +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +import * as childProcess from "child_process"; +import * as path from "path"; +import { directoryExistsSync, fileExistsSync, resolveMacArduinoAppPath } from "../util"; + +export function resolveArduinoPath(): string { + let result; + + const defaultCommonPaths = [path.join(process.env.HOME, "Applications"), "/Applications"]; + for (const scanPath of defaultCommonPaths) { + if (directoryExistsSync(path.join(scanPath, "Arduino.app"))) { + result = scanPath; + break; + } + } + return result || ""; +} + +export function validateArduinoPath(arduinoPath: string, useArduinoCli = false): boolean { + return fileExistsSync(path.join(resolveMacArduinoAppPath(arduinoPath, useArduinoCli), useArduinoCli ? "arduino-cli" : "/Contents/MacOS/Arduino")); +} + +export function findFile(fileName: string, cwd: string): string { + let pathString; + try { + pathString = childProcess.execSync(`find ${cwd} -name ${fileName} -type f`, { encoding: "utf8" }).split("\n"); + + if (pathString && pathString[0] && fileExistsSync(pathString[0].trim())) { + pathString = path.normalize(pathString[0].trim()); + } else { + pathString = null; + } + } catch (ex) { + // Ignore the errors. + } + return pathString; +} diff --git a/src/common/util.ts b/src/common/util.ts index 4445d0de..b82aa422 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -426,8 +426,8 @@ export function convertToHex(number, width = 0) { * in case you named Arduino with a version number * @argument {string} arduinoPath */ -export function resolveMacArduinoAppPath(arduinoPath: string): string { - if (/Arduino.*\.app/.test(arduinoPath)) { +export function resolveMacArduinoAppPath(arduinoPath: string, useArduinoCli = false): string { + if (useArduinoCli || /Arduino.*\.app/.test(arduinoPath)) { return arduinoPath; } else { return path.join(arduinoPath, "Arduino.app"); diff --git a/src/deviceContext.ts b/src/deviceContext.ts index 16451a81..0cfaa358 100644 --- a/src/deviceContext.ts +++ b/src/deviceContext.ts @@ -112,7 +112,7 @@ export class DeviceContext implements IDeviceContext, vscode.Disposable { this._watcher.onDidDelete(() => this.loadContext()); this._vscodeWatcher.onDidDelete(() => this.loadContext()); this._sketchStatusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, constants.statusBarPriority.SKETCH); - this._sketchStatusBar.command = "arduino.setSketchFile"; + this._sketchStatusBar.command = "arduino.selectSketch"; this._sketchStatusBar.tooltip = "Sketch File"; } } diff --git a/src/extension.ts b/src/extension.ts index 6ae7b0df..b4f6f456 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -156,24 +156,40 @@ export async function activate(context: vscode.ExtensionContext) { return { board: arduinoContextModule.default.boardManager.currentBoard.name }; }); - registerArduinoCommand("arduino.setSketchFile", async () => { + registerArduinoCommand("arduino.selectSketch", async () => { const sketchFileName = deviceContext.sketch; - const newSketchFileName = await vscode.window.showInputBox({ - placeHolder: sketchFileName, - validateInput: (value) => { - if (value && /\.((ino)|(cpp)|c)$/.test(value.trim())) { - return null; - } else { - return "Invalid sketch file name. Should be *.ino/*.cpp/*.c"; - } - }, - }); + + // Include any ino, cpp, or c files under the workspace folder + const includePattern = "**/*.{ino,cpp,c}"; + + // The sketchbook folder may contain hardware & library folders, any sketches under these paths + // should be excluded + const sketchbookPath = arduinoContextModule.default.arduinoApp.settings.sketchbookPath; + const excludePatterns = [ + path.relative(ArduinoWorkspace.rootPath, sketchbookPath + "/hardware/**"), + path.relative(ArduinoWorkspace.rootPath, sketchbookPath + "/libraries/**")]; + + // If an output path is specified, it should be excluded as well + if (deviceContext.output) { + const outputPath = path.relative(ArduinoWorkspace.rootPath, + path.resolve(ArduinoWorkspace.rootPath, deviceContext.output)); + excludePatterns.push(`${outputPath}/**`); + } + const excludePattern = `{${excludePatterns.map((p) => p.replace("\\", "/")).join(",")}}`; + + const fileUris = await vscode.workspace.findFiles(includePattern, excludePattern); + const newSketchFileName = await vscode.window.showQuickPick(fileUris.map((fileUri) => + ({ + label: path.relative(ArduinoWorkspace.rootPath, fileUri.fsPath), + description: fileUri.fsPath, + })), + { placeHolder: sketchFileName, matchOnDescription: true }); if (!newSketchFileName) { return; } - deviceContext.sketch = newSketchFileName; + deviceContext.sketch = newSketchFileName.label; deviceContext.showStatusBar(); }); diff --git a/src/views/package-lock.json b/src/views/package-lock.json index 3a4e101d..5e30cfbf 100644 --- a/src/views/package-lock.json +++ b/src/views/package-lock.json @@ -843,12 +843,6 @@ "yallist": "^3.0.2" } }, - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - }, "yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", @@ -1683,24 +1677,24 @@ } }, "elliptic": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", - "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", "dev": true, "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", + "bn.js": "^4.11.9", + "brorand": "^1.1.0", "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" }, "dependencies": { "bn.js": { - "version": "4.11.9", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", - "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true } } @@ -6414,9 +6408,9 @@ "dev": true }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yallist": { diff --git a/test/extension.test.ts b/test/extension.test.ts index fb746313..6c91b0e9 100644 --- a/test/extension.test.ts +++ b/test/extension.test.ts @@ -54,7 +54,7 @@ suite("Arduino: Extension Tests", () => { "arduino.showExampleExplorer", "arduino.loadPackages", "arduino.installBoard", - "arduino.setSketchFile", + "arduino.selectSketch", "arduino.cliUpload", "arduino.cliUploadUsingProgrammer", ]; From 383dceff8024e18685015cea3b85a8f0adf938de Mon Sep 17 00:00:00 2001 From: Adi Azulay Date: Wed, 5 May 2021 09:27:35 -0700 Subject: [PATCH 2/2] bump to v0.4.2 (#1248) * bump to v0.4.2 --- CHANGELOG.md | 8 +++++++- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 913605a9..c671072c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. + +## Version 0.4.2 + +### Fixed +- Update app insights key + ## Version 0.4.1 ### Added @@ -10,7 +16,7 @@ All notable changes to this project will be documented in this file. - Arduino CLI on MacOS [#1221](https://github.com/microsoft/vscode-arduino/issues/1221) Thanks [@awmichel](https://github.com/awmichel) - Typos [#1226](https://github.com/microsoft/vscode-arduino/pull/1226), [#1225](https://github.com/microsoft/vscode-arduino/pull/1225), [#1191](https://github.com/microsoft/vscode-arduino/pull/1191) Thanks [@jogo-](https://github.com/jogo-) [@CBielstein](https://github.com/CBielstein) - add USBCON back into IntelliSense config [#1216](https://github.com/microsoft/vscode-arduino/issues/1216) -- Update depedencies +- Update dependencies - App Insights key in Actions [#1236](https://github.com/microsoft/vscode-arduino/pull/1236) ## Version 0.4.0 diff --git a/package-lock.json b/package-lock.json index 4354db20..97dae208 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vscode-arduino", - "version": "0.4.1", + "version": "0.4.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d049cf7a..15021e6b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-arduino", "displayName": "Arduino", "description": "Arduino for Visual Studio Code", - "version": "0.4.1", + "version": "0.4.2", "publisher": "vsciot-vscode", "aiKey": "83dd2c27-6594-41d3-85a9-bdb22070eb42", "preview": true,