Compare commits

...

24 Commits

Author SHA1 Message Date
Akos Kitta
750486a8f0 another approach
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
2022-09-15 19:12:31 +02:00
Francesco Spissu
a04527d3b8 different prefix for temp example sketch 2022-09-15 19:12:31 +02:00
Francesco Spissu
33ec67109b mark as recently opened only sketches that not includes sketch_ in the name 2022-09-15 19:12:31 +02:00
Alberto Iannaccone
4e590ab618 use ipc message to focus on serial plotter window (#1410) 2022-09-15 16:07:13 +02:00
Dave Simpson
026e80e7fc fix #1383: missing port labels (#1412)
* fallback to port.address if addressLabel is false

* addressLabel if possible, reconcileAvailableBoards

* remove fallback
2022-09-15 15:29:28 +02:00
Akos Kitta
fdf6f0f9c8 Avoid deleting the workspace when it's still in use.
- From now on, NSFW service disposes after last reference
is removed. No more 10sec delay.
 - Moved the temp workspace deletion to a startup task.
 - Can set initial task for the window from electron-main.
 - Removed the `browser-app`.

Closes #39

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
2022-09-15 15:24:25 +02:00
per1234
0151e4c224 Make instructions re: non-notarized PR tester build more user friendly
For security reasons, the macOS tester builds generated for PRs from forks are not notarized. Instructions are provided for
beta testing under these conditions.

Previously, the instructions for bypassing the macOS notarization requirement involved disabling macOS Gatekeeper
entirely using the spctl command. These instructions are hereby replaced by an alternative approach, where the
restriction is bypassed for the Arduino IDE application alone, via the macOS GUI.

The new approach is superior for the following reasons:

- More secure due to having limited scope
- More accessible due to the use of the macOS GUI
2022-09-15 05:53:09 -07:00
per1234
e8b0ea4f2d Reduce overlap between readme and development+contributor guides
The readme should provide a concise overview of the essential information about the project. Additional details are
provided in dedicated documents, so the readme only needs to provide links to that information.
2022-09-15 05:53:09 -07:00
per1234
7c1ca04c75 Add a project contributor guide
Documentation of how to contribute to the project gives everyone the opportunity to participate, while also reducing the
maintenance effort and increasing the quality of contributions.

This guide documents the various ways of contributing to the project.
2022-09-15 05:53:09 -07:00
per1234
0ba88d5ab6 Move beta testing information to a dedicated documentation file
Previously, the information about tester builds was mixed in with the documentation about building the project from
source.

The two subjects are of relevance to two distinct contribution options. Building from source will primarily be done by
developers working on the project code base. Tester builds will be used by beta testers and reviewers.

For this reason, it doesn't make sense to require beta testers to wade through a lot of development documentation not
directly related to their work in order to find the instructions for obtaining tester builds. Likewise, it doesn't make
sense to clutter up the development documentation with such information.

Moving the information about tester builds to a dedicated file makes it easier for the interested parties to find, and
also allows the creation of a comprehensive guide for beta testers without making a negative impact on the development
documentation content.
2022-09-15 05:53:09 -07:00
per1234
96e229d803 Move documentation assets to standard location 2022-09-15 05:53:09 -07:00
per1234
d07d83fdfe Move development documentation to a more suitable location
Previously, information about project development was stored in a file named BUILDING.md in the root of the repository.

That content is hereby moved to the file docs/development.md. This will provide the following benefits:

- Broaden the scope of the file to all information related to development rather than building only
- Store all documentation content under a single folder instead of randomly putting some in the root and others under
  docs
2022-09-15 05:53:09 -07:00
Akos Kitta
5f82577bc1 Can send message to the monitor with Enter.
Removed the required `Ctrl/Cmd` modifier.

Closes #572

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
2022-09-14 17:18:31 +02:00
per1234
35fcfb89c1 Remove obsolete fragment identifier from IDE manual download link
The Arduino IDE has an auto update capability. A new version is checked for on every startup, and if available the user
is offered an update.

Although this update can usually be done automatically by the IDE, under some conditions this is not possible. For
example:

- The IDE package in use does not support auto update (i.e., Linux ZIP package)
- The file could not be downloaded due to a transient network service outage

In this case, the user is presented with a friendly dialog that explains the situation and links to the "Software" page
on arduino.cc, where the user can manually download and install the new version.

During the pre-release development phase of the project, the download links for Arduino IDE 2.x were on a sub-section of
the "Software" page. For this reason, the linked URL included the fragment identifier `#experimental-software` so that
the page would load scrolled down to the anchor at that section of the page.

With the 2.0.0 release, the Arduino IDE 2.x project has graduated to a production development phase. For this reason,
the download links have been moved to the top of the "Software" page and the now inaccurate `experimental-software`
anchor removed from the page.

The previous link with that fragment is still perfectly functional, but the fragment to a non-existent anchor serves no
purpose and also miscommunicates the project status to users who notice the URL that was loaded. For this reason, it is
hereby removed from the link.
2022-09-14 05:14:58 -07:00
Alberto Iannaccone
6e3fe08c4c update README.md 2022-09-13 23:58:23 -07:00
Alberto Iannaccone
7f06b148f4 Revert "change naming of nightly and snapshot builds (#1326)"
This reverts commit 5be1f9d7fe.
2022-09-13 23:58:23 -07:00
Alberto Iannaccone
bf303d1b2f 2.0.0 2022-09-13 23:58:23 -07:00
per1234
59ca91d805 Remove table of nightly build links from readme
During the early phase of development, the download links for the nightly build were only available from the table in the project readme.

Since that time, download links were also added to the "Software" page on arduino.cc, which is already linked to from
the readme. This means the nightly build link table is superfluous and only harms the readability of the readme.

The superfluous table is hereby removed from the readme.
2022-09-12 06:04:36 -07:00
github-actions[bot]
69bb0aa385 Updated translation files (#1421)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-09-12 09:53:06 +02:00
per1234
565970e779 Update release procedure documentation
An internal release procedure document was created separately from the documentation hosted in this repository. That
internal document became significantly more comprehensive and up to date than the unmaintained documentation in this
repository.

In order to avoid either the burden of maintaining two copies of the same information, or more likely the out of sync
state between the information in the two resulting from lack of such maintenance, a single document will be maintained
here in this repository.

The superior version of the information from the internal document is hereby migrated to the repository where it will be
maintained from here on.
2022-09-08 13:30:36 -07:00
per1234
fec3b1138b Move release procedure documentation to more appropriate location
Previously, the procedure for creating a new release of the project was included in the development documentation.

This information is distinct from the rest of the contents of that file in that it is not of any value or interest to
most contributors from the community since only project maintainers will ever create a release. This meant that it make
the document less readable and approachable without adding significant value in return.

The information is still essential to the project maintainers, so it must not be removed, but it can be moved to a
dedicated file under the existing `docs/internal/` folder that is specifically intended for storing such information.
2022-09-08 13:30:36 -07:00
Alberto Iannaccone
dcc0c0aa5d Prepare 2.0.0-rc9.4 (#1411) 2022-09-08 10:00:42 +02:00
Muhammad Zaheer
76673cb553 Time format in SerialMonitor changed.Fixes #580 2022-09-08 00:15:26 -07:00
per1234
8f95fd6ca6 Add instructions for accessing IDE's advanced settings
Although the Arduino IDE's primary preferences interface provides all required configuration capabilities, advanced
users may wish to fine tune the behavior of the application or temporarily enable additional log output to use for
troubleshooting problems with the IDE.

The IDE provides such settings in a separate interface.

Previously, the existence and access procedure for these settings was undocumented.

Since this is an advanced capability, the documentation is not appropriate for inclusion with the standard user
documentation on arduino.cc. A file here in the Arduino IDE is used instead. This file will serve as a container for all
such user-targeted documentation.
2022-09-07 00:16:14 -07:00
71 changed files with 1362 additions and 879 deletions

View File

@@ -17,7 +17,6 @@ module.exports = {
'scripts/*',
'electron/*',
'electron-app/*',
'browser-app/*',
'plugins/*',
'arduino-ide-extension/src/node/cli-protocol',
],

View File

@@ -8,6 +8,12 @@ contact_links:
- name: Support request
url: https://forum.arduino.cc/
about: We can help you out on the Arduino Forum!
- name: Issue report guide
url: https://github.com/arduino/arduino-ide/blob/main/docs/issues.md#issue-report-guide
about: Learn about submitting issue reports to this repository.
- name: Contributor guide
url: https://github.com/arduino/arduino-ide/blob/main/docs/CONTRIBUTING.md#contributor-guide
about: Learn about contributing to this project.
- name: Discuss development work on the project
url: https://groups.google.com/a/arduino.cc/g/developers
about: Arduino Developers Mailing List

31
.vscode/launch.json vendored
View File

@@ -80,37 +80,6 @@
"port": 9222,
"webRoot": "${workspaceFolder}/electron-app"
},
{
"type": "node",
"request": "launch",
"name": "App (Browser)",
"program": "${workspaceRoot}/browser-app/src-gen/backend/main.js",
"args": [
"--hostname=0.0.0.0",
"--port=3000",
"--no-cluster",
"--no-app-auto-install",
"--plugins=local-dir:plugins"
],
"windows": {
"env": {
"NODE_ENV": "development",
"NODE_PRESERVE_SYMLINKS": "1"
}
},
"env": {
"NODE_ENV": "development"
},
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/browser-app/src-gen/backend/*.js",
"${workspaceRoot}/browser-app/lib/**/*.js",
"${workspaceRoot}/arduino-ide-extension/lib/**/*.js"
],
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "std"
},
{
"type": "node",
"request": "launch",

30
.vscode/tasks.json vendored
View File

@@ -12,17 +12,6 @@
"clear": false
}
},
{
"label": "Arduino IDE - Start Browser App",
"type": "shell",
"command": "yarn --cwd ./browser-app start",
"group": "build",
"presentation": {
"reveal": "always",
"panel": "new",
"clear": true
}
},
{
"label": "Arduino IDE - Watch IDE Extension",
"type": "shell",
@@ -34,17 +23,6 @@
"clear": false
}
},
{
"label": "Arduino IDE - Watch Browser App",
"type": "shell",
"command": "yarn --cwd ./browser-app watch",
"group": "build",
"presentation": {
"reveal": "always",
"panel": "new",
"clear": false
}
},
{
"label": "Arduino IDE - Watch Electron App",
"type": "shell",
@@ -56,14 +34,6 @@
"clear": false
}
},
{
"label": "Arduino IDE - Watch All [Browser]",
"type": "shell",
"dependsOn": [
"Arduino IDE - Watch IDE Extension",
"Arduino IDE - Watch Browser App"
]
},
{
"label": "Arduino IDE - Watch All [Electron]",
"type": "shell",

View File

@@ -1,152 +1,3 @@
# Development
This page includes technical documentation for developers who want to build the IDE locally and contribute to the project.
## Architecture overview
The IDE consists of three major parts:
- the _Electron main_ process,
- the _backend_, and
- the _frontend_.
The _Electron main_ process is responsible for:
- creating the application,
- managing the application lifecycle via listeners, and
- creating and managing the web pages for the app.
In Electron, the process that runs the main entry JavaScript file is called the main process. The _Electron main_ process can display a GUI by creating web pages. An Electron app always has exactly one main process.
By default, whenever the _Electron main_ process creates a web page, it will instantiate a new `BrowserWindow` instance. Since Electron uses Chromium for displaying web pages, Chromium's multi-process architecture is also used. Each web page in Electron runs in its own process, which is called the renderer process. Each `BrowserWindow` instance runs the web page in its own renderer process. When a `BrowserWindow` instance is destroyed, the corresponding renderer process is also terminated. The main process manages all web pages and their corresponding renderer processes. Each renderer process is isolated and only cares about the web page running in it.<sup>[[1]]</sup>
In normal browsers, web pages usually run in a sandboxed environment, and accessing native resources are disallowed. However, Electron has the power to use Node.js APIs in the web pages allowing lower-level OS interactions. Due to security reasons, accessing native resources is an undesired behavior in the IDE. So by convention, we do not use Node.js APIs. (Note: the Node.js integration is [not yet disabled](https://github.com/eclipse-theia/theia/issues/2018) although it is not used). In the IDE, only the _backend_ allows OS interaction.
The _backend_ process is responsible for:
- providing access to the filesystem,
- communicating with the [Arduino CLI](https://github.com/arduino/arduino-cli) via gRPC,
- running your terminal,
- exposing additional RESTful APIs,
- performing the Git commands in the local repositories,
- hosting and running any VS Code extensions, or
- executing VS Code tasks<sup>[[2]]</sup>.
The _Electron main_ process spawns the _backend_ process. There is always exactly one _backend_ process. However, due to performance considerations, the _backend_ spawns several sub-processes for the filesystem watching, Git repository discovery, etc. The communication between the _backend_ process and its sub-processes is established via IPC. Besides spawning sub-processes, the _backend_ will start an HTTP server on a random available port, and serves the web application as static content. When the sub-processes are up and running, and the HTTP server is also listening, the _backend_ process sends the HTTP server port to the _Electron main_ process via IPC. The _Electron main_ process will load the _backend_'s endpoint in the `BrowserWindow`.
The _frontend_ is running as an Electron renderer process and can invoke services implemented on the _backend_. The communication between the _backend_ and the _frontend_ is done via JSON-RPC over a websocket connection. This means, the services running in the _frontend_ are all proxies, and will ask the corresponding service implementation on the _backend_.
[1]: https://www.electronjs.org/docs/tutorial/application-architecture#differences-between-main-process-and-renderer-process
[2]: https://code.visualstudio.com/Docs/editor/tasks
## Build from source
If youre familiar with TypeScript, the [Theia IDE](https://theia-ide.org/), and if you want to contribute to the
project, you should be able to build the Arduino IDE locally.
Please refer to the [Theia IDE prerequisites](https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisites) documentation for the setup instructions.
> **Note**: Node.js 14 must be used instead of the version 12 recommended at the link above.
Once you have all the tools installed, you can build the editor following these steps
1. Install the dependencies and build
```sh
yarn
```
2. Rebuild the dependencies
```sh
yarn rebuild:browser
```
3. Rebuild the electron dependencies
```sh
yarn rebuild:electron
```
4. Start the application
```sh
yarn start
```
### Notes for Windows contributors
Windows requires the Microsoft Visual C++ (MSVC) compiler toolset to be installed on your development machine.
In case it's not already present, it can be downloaded from the "**Tools for Visual Studio 20XX**" section of the Visual Studio [downloads page](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) via the "**Build Tools for Visual Studio 20XX**" (e.g., "**Build Tools for Visual Studio 2022**") download link.
Select "**Desktop development with C++**" from the "**Workloads**" tab during the installation procedure.
### CI
This project is built on [GitHub Actions](https://github.com/arduino/arduino-ide/actions).
- _Snapshot_ builds run when changes are pushed to the `main` branch, or when a PR is created against the `main` branch. For the sake of the review and verification process, the build artifacts for each operating system can be downloaded from the GitHub Actions page.
- _Nightly_ builds run every day at 03:00 GMT from the `main` branch.
- _Release_ builds run when a new tag is pushed to the remote. The tag must follow the [semver](https://semver.org/). For instance, `1.2.3` is a correct tag, but `v2.3.4` won't work. Steps to trigger a new release build:
- Create a local tag:
```sh
git tag -a 1.2.3 -m "Creating a new tag for the `1.2.3` release."
```
- Push it to the remote:
```sh
git push origin 1.2.3
```
## Notes for macOS contributors
Beginning in macOS 10.14.5, the software [must be notarized to run](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution). The signing and notarization processes for the Arduino IDE are managed by our Continuous Integration (CI) workflows, implemented with GitHub Actions. On every push and pull request, the Arduino IDE is built and saved to a workflow artifact. These artifacts can be used by contributors and beta testers who don't want to set up a build system locally.
For security reasons, signing and notarization are disabled for workflow runs for pull requests from forks of this repository. This means that macOS will block you from running those artifacts.
Due to this limitation, Mac users have two options for testing contributions from forks:
### The Safe approach (recommended)
Follow [the instructions above](#build-from-source) to create the build environment locally, then build the code you want to test.
### The Risky approach
*Please note that this approach is risky as you are lowering the security on your system, therefore we strongly discourage you from following it.*
1. Use [this guide](https://help.apple.com/xcode/mac/10.2/index.html?localePath=en.lproj#/dev9b7736b0e), in order to disable Gatekeeper (at your own risk!).
1. Download the unsigned artifact provided by the CI workflow run related to the Pull Request at each push.
1. Re-enable Gatekeeper after tests are done, following the guide linked above.
### Creating a release
You will not need to create a new release yourself as the Arduino team takes care of this on a regular basis, but we are documenting the process here. Let's assume the current version is `0.1.3` and you want to release `0.2.0`.
- Make sure the `main` state represents what you want to release and you're on `main`.
- Prepare a release-candidate build on a branch:
```bash
git branch 0.2.0-rc \
&& git checkout 0.2.0-rc
```
- Bump up the version number. It must be a valid [semver](https://semver.org/) and must be greater than the current one:
```bash
yarn update:version 0.2.0
```
- This should generate multiple outgoing changes with the version update.
- Commit your changes and push to the remote:
```bash
git add . \
&& git commit -s -m "Updated versions to 0.2.0" \
&& git push
```
- Create the GH PR the workflow starts automatically.
- Once you're happy with the RC, merge the changes to the `main`.
- Create a tag and push it:
```bash
git tag -a 0.2.0 -m "0.2.0" \
&& git push origin 0.2.0
```
- The release build starts automatically and uploads the artifacts with the changelog to the [release page](https://github.com/arduino/arduino-ide/releases).
- If you do not want to release the `EXE` and `MSI` installers, wipe them manually.
- If you do not like the generated changelog, modify it and update the GH release.
## FAQ
* *Can I manually change the version of the [`arduino-cli`](https://github.com/arduino/arduino-cli/) used by the IDE?*
Yes. It is possible but not recommended. The CLI exposes a set of functionality via [gRPC](https://github.com/arduino/arduino-cli/tree/master/rpc) and the IDE uses this API to communicate with the CLI. Before we build a new version of IDE, we pin a specific version of CLI and use the corresponding `proto` files to generate TypeScript modules for gRPC. This means, a particular version of IDE is compliant only with the pinned version of CLI. Mismatching IDE and CLI versions might not be able to communicate with each other. This could cause unpredictable IDE behavior.
* *I have understood that not all versions of the CLI are compatible with my version of IDE but how can I manually update the `arduino-cli` inside the IDE?*
[Get](https://arduino.github.io/arduino-cli/installation) the desired version of `arduino-cli` for your platform and manually replace the one inside the IDE. The CLI can be found inside the IDE at:
- Windows: `C:\path\to\Arduino IDE\resources\app\node_modules\arduino-ide-extension\build\arduino-cli.exe`,
- macOS: `/path/to/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-cli`, and
- Linux: `/path/to/Arduino IDE/resources/app/node_modules/arduino-ide-extension/build/arduino-cli`.
# Development Guide
This documentation has been moved [**here**](docs/development.md#development-guide).

View File

@@ -1,45 +1,18 @@
<img src="https://content.arduino.cc/website/Arduino_logo_teal.svg" height="100" align="right" />
# Arduino IDE 2.x (beta)
# Arduino IDE 2.x
[![Arduino IDE](https://github.com/arduino/arduino-ide/workflows/Arduino%20IDE/badge.svg)](https://github.com/arduino/arduino-ide/actions?query=workflow%3A%22Arduino+IDE%22)
This repository contains the source code of the Arduino IDE 2.x, which is currently in beta stage. If you're looking for the stable IDE, go to the repository of the 1.x version at https://github.com/arduino/Arduino.
This repository contains the source code of the Arduino IDE 2.x. If you're looking for the old IDE, go to the repository of the 1.x version at https://github.com/arduino/Arduino.
The Arduino IDE 2.x is a major rewrite, sharing no code with the IDE 1.x. It is based on the [Theia IDE](https://theia-ide.org/) framework and built with [Electron](https://www.electronjs.org/). The backend operations such as compilation and uploading are offloaded to an [arduino-cli](https://github.com/arduino/arduino-cli) instance running in daemon mode. This new IDE was developed with the goal of preserving the same interface and user experience of the previous major version in order to provide a frictionless upgrade.
> ⚠️ This is **beta** software. Help us test it!
![](static/screenshot.png)
## Download
You can download the latest version from the [software download page on the Arduino website](https://www.arduino.cc/en/software#experimental-software).
### Nightly builds
These builds are generated every day at 03:00 GMT from the `main` branch and
should be considered unstable:
| Platform | 32 bit | 64 bit |
| --------- | ------------------------ | ------------------------------------------------------------------------------------------------------ |
| Linux | | [Nightly Linux AppImage 64 bit]<br />[Nightly Linux ZIP file 64 bit] |
| Linux ARM | [🚧 Work in progress...] | [🚧 Work in progress...] |
| Windows | | [Nightly Windows 64 bit installer]<br />[Nightly Windows 64 bit MSI]<br />[Nightly Windows 64 bit ZIP] |
| macOS | | [Nightly macOS 64 bit] |
[🚧 work in progress...]: https://github.com/arduino/arduino-ide/issues/107
[nightly linux appimage 64 bit]: https://downloads.arduino.cc/arduino-ide/nightly/arduino-ide_nightly-latest_Linux_64bit.AppImage
[nightly linux zip file 64 bit]: https://downloads.arduino.cc/arduino-ide/nightly/arduino-ide_nightly-latest_Linux_64bit.zip
[nightly windows 64 bit installer]: https://downloads.arduino.cc/arduino-ide/nightly/arduino-ide_nightly-latest_Windows_64bit.exe
[nightly windows 64 bit msi]: https://downloads.arduino.cc/arduino-ide/nightly/arduino-ide_nightly-latest_Windows_64bit.msi
[nightly windows 64 bit zip]: https://downloads.arduino.cc/arduino-ide/nightly/arduino-ide_nightly-latest_Windows_64bit.zip
[nightly macos 64 bit]: https://downloads.arduino.cc/arduino-ide/nightly/arduino-ide_nightly-latest_macOS_64bit.dmg
> These links return an HTTP `302: Found` response, redirecting to latest
> generated builds by replacing `latest` with the latest available build
> date, using the format YYYYMMDD (i.e for 2019/Aug/06 `latest` is
> replaced with `20190806`)
You can download the latest release version and nightly builds from the [software download page on the Arduino website](https://www.arduino.cc/en/software).
## Support
@@ -47,10 +20,9 @@ If you need assistance, see the [Help Center](https://support.arduino.cc/hc/en-u
## Bugs & Issues
If you want to report an issue, you can submit it to the [issue tracker](https://github.com/arduino/arduino-ide/issues) of this repository. A few rules apply:
If you want to report an issue, you can submit it to the [issue tracker](https://github.com/arduino/arduino-ide/issues) of this repository.
- Before posting, please check if the same problem has been already reported by someone else to avoid duplicates.
- Remember to include as much detail as you can about your hardware set-up, code and steps for reproducing the issue. Make sure you're using an original Arduino board.
See [**the issue report guide**](docs/contributor-guide/issues.md#issue-report-guide) for instructions.
### Security
@@ -62,16 +34,15 @@ e-mail contact: security@arduino.cc
## Contributions and development
Contributions are very welcome! You can browse the list of open issues to see what's needed and then you can submit your code using a Pull Request. Please provide detailed descriptions. We also appreciate any help in testing issues and patches contributed by other users.
Contributions are very welcome! There are several ways to participate in this project, including:
This repository contains the main code, but two more repositories are included during the build process:
- Fixing bugs
- Beta testing
- Translation
- [vscode-arduino-tools](https://github.com/arduino/vscode-arduino-tools): provides support for the language server and the debugger
- [arduino-language-server](https://github.com/arduino/arduino-language-server): provides the language server that parses Arduino code
See [**the contributor guide**](docs/CONTRIBUTING.md#contributor-guide) for more information.
See the [BUILDING.md](BUILDING.md) for a technical overview of the application and instructions for building the code.
You can help with the translation of the Arduino IDE to your language here: [Arduino IDE on Transifex](https://www.transifex.com/arduino-1/ide2/dashboard/).
See the [**development guide**](docs/development.md) for a technical overview of the application and instructions for building the code.
## Donations

View File

@@ -1,6 +1,6 @@
{
"name": "arduino-ide-extension",
"version": "2.0.0-rc9.3",
"version": "2.0.0",
"description": "An extension for Theia building the Arduino IDE",
"license": "AGPL-3.0-or-later",
"scripts": {
@@ -147,11 +147,9 @@
"frontend": "lib/browser/arduino-ide-frontend-module"
},
{
"frontend": "lib/browser/theia/core/browser-menu-module",
"frontendElectron": "lib/electron-browser/theia/core/electron-menu-module"
},
{
"frontend": "lib/browser/theia/core/browser-window-module",
"frontendElectron": "lib/electron-browser/theia/core/electron-window-module"
},
{
@@ -160,7 +158,7 @@
],
"arduino": {
"cli": {
"version": "0.27.0-rc.1"
"version": "0.27.1"
},
"fwuploader": {
"version": "2.2.0"

View File

@@ -105,7 +105,8 @@ import {
} from '@theia/core/lib/browser/connection-status-service';
import { BoardsDataMenuUpdater } from './boards/boards-data-menu-updater';
import { BoardsDataStore } from './boards/boards-data-store';
import { ILogger } from '@theia/core';
import { ILogger } from '@theia/core/lib/common/logger';
import { bindContributionProvider } from '@theia/core/lib/common/contribution-provider';
import {
FileSystemExt,
FileSystemExtPath,
@@ -308,7 +309,7 @@ import { CoreErrorHandler } from './contributions/core-error-handler';
import { CompilerErrors } from './contributions/compiler-errors';
import { WidgetManager } from './theia/core/widget-manager';
import { WidgetManager as TheiaWidgetManager } from '@theia/core/lib/browser/widget-manager';
import { StartupTasks } from './widgets/sketchbook/startup-task';
import { StartupTasks } from './contributions/startup-task';
import { IndexesUpdateProgress } from './contributions/indexes-update-progress';
import { Daemon } from './contributions/daemon';
import { FirstStartupInstaller } from './contributions/first-startup-installer';
@@ -334,6 +335,8 @@ import {
} from './widgets/component-list/filter-renderer';
import { CheckForUpdates } from './contributions/check-for-updates';
import { OutputEditorFactory } from './theia/output/output-editor-factory';
import { StartupTaskProvider } from '../electron-common/startup-task';
import { DeleteSketch } from './contributions/delete-sketch';
const registerArduinoThemes = () => {
const themes: MonacoThemeJson[] = [
@@ -433,6 +436,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
// Boards service client to receive and delegate notifications from the backend.
bind(BoardsServiceProvider).toSelf().inSingletonScope();
bind(FrontendApplicationContribution).toService(BoardsServiceProvider);
bind(CommandContribution).toService(BoardsServiceProvider);
// To be able to track, and update the menu based on the core settings (aka. board details) of the currently selected board.
bind(FrontendApplicationContribution)
@@ -757,6 +761,10 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
Contribution.configure(bind, OpenBoardsConfig);
Contribution.configure(bind, SketchFilesTracker);
Contribution.configure(bind, CheckForUpdates);
Contribution.configure(bind, DeleteSketch);
bindContributionProvider(bind, StartupTaskProvider);
bind(StartupTaskProvider).toService(BoardsServiceProvider); // to reuse the boards config in another window
// Disabled the quick-pick customization from Theia when multiple formatters are available.
// Use the default VS Code behavior, and pick the first one. In the IDE2, clang-format has `exclusive` selectors.

View File

@@ -413,53 +413,5 @@ export namespace BoardsConfig {
const { name } = selectedBoard;
return `${name}${port ? ` at ${port.address}` : ''}`;
}
export function setConfig(
config: Config | undefined,
urlToAttachTo: URL
): URL {
const copy = new URL(urlToAttachTo.toString());
if (!config) {
copy.searchParams.delete('boards-config');
return copy;
}
const selectedBoard = config.selectedBoard
? {
name: config.selectedBoard.name,
fqbn: config.selectedBoard.fqbn,
}
: undefined;
const selectedPort = config.selectedPort
? {
protocol: config.selectedPort.protocol,
address: config.selectedPort.address,
}
: undefined;
const jsonConfig = JSON.stringify({ selectedBoard, selectedPort });
copy.searchParams.set('boards-config', encodeURIComponent(jsonConfig));
return copy;
}
export function getConfig(url: URL): Config | undefined {
const encoded = url.searchParams.get('boards-config');
if (!encoded) {
return undefined;
}
try {
const raw = decodeURIComponent(encoded);
const candidate = JSON.parse(raw);
if (typeof candidate === 'object') {
return candidate;
}
console.warn(
`Expected candidate to be an object. It was ${typeof candidate}. URL was: ${url}`
);
return undefined;
} catch (e) {
console.log(`Could not get board config from URL: ${url}.`, e);
return undefined;
}
}
}
}

View File

@@ -1,7 +1,12 @@
import { injectable, inject } from '@theia/core/shared/inversify';
import { Emitter } from '@theia/core/lib/common/event';
import { ILogger } from '@theia/core/lib/common/logger';
import { CommandService } from '@theia/core/lib/common/command';
import {
Command,
CommandContribution,
CommandRegistry,
CommandService,
} from '@theia/core/lib/common/command';
import { MessageService } from '@theia/core/lib/common/message-service';
import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application';
import { RecursiveRequired } from '../../common/types';
@@ -23,9 +28,18 @@ import { nls } from '@theia/core/lib/common';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import { Unknown } from '../../common/nls';
import {
StartupTask,
StartupTaskProvider,
} from '../../electron-common/startup-task';
@injectable()
export class BoardsServiceProvider implements FrontendApplicationContribution {
export class BoardsServiceProvider
implements
FrontendApplicationContribution,
StartupTaskProvider,
CommandContribution
{
@inject(ILogger)
protected logger: ILogger;
@@ -50,6 +64,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
AvailableBoard[]
>();
protected readonly onAvailablePortsChangedEmitter = new Emitter<Port[]>();
private readonly inheritedConfig = new Deferred<BoardsConfig.Config>();
/**
* Used for the auto-reconnecting. Sometimes, the attached board gets disconnected after uploading something to it.
@@ -115,6 +130,13 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
});
}
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(USE_INHERITED_CONFIG, {
execute: (inheritedConfig: BoardsConfig.Config) =>
this.inheritedConfig.resolve(inheritedConfig),
});
}
get reconciled(): Promise<void> {
return this._reconciled.promise;
}
@@ -578,6 +600,7 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
boardsConfig.selectedBoard &&
availableBoards.every(({ selected }) => !selected)
) {
let port = boardsConfig.selectedPort
// If the selected board has the same port of an unknown board
// that is already in availableBoards we might get a duplicate port.
// So we remove the one already in the array and add the selected one.
@@ -585,11 +608,15 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
(board) => board.port?.address === boardsConfig.selectedPort?.address
);
if (found >= 0) {
// get the "Unknown board port" that we will substitute,
// then we can include it in the "availableBoard object"
// pushed below; to ensure addressLabel is included
port = availableBoards[found].port
availableBoards.splice(found, 1);
}
availableBoards.push({
...boardsConfig.selectedBoard,
port: boardsConfig.selectedPort,
port,
selected: true,
state: AvailableBoard.State.incomplete,
});
@@ -655,11 +682,14 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
let storedLatestBoardsConfig = await this.getData<
BoardsConfig.Config | undefined
>('latest-boards-config');
// Try to get from the URL if it was not persisted.
// Try to get from the startup task. Wait for it, then timeout. Maybe it never arrives.
if (!storedLatestBoardsConfig) {
storedLatestBoardsConfig = BoardsConfig.Config.getConfig(
new URL(window.location.href)
);
storedLatestBoardsConfig = await Promise.race([
this.inheritedConfig.promise,
new Promise<undefined>((resolve) =>
setTimeout(() => resolve(undefined), 2_000)
),
]);
}
if (storedLatestBoardsConfig) {
this.latestBoardsConfig = storedLatestBoardsConfig;
@@ -682,8 +712,31 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
key
);
}
tasks(): StartupTask[] {
return [
{
command: USE_INHERITED_CONFIG.id,
args: [this.boardsConfig],
},
];
}
}
/**
* It should be neither visible nor called from outside.
*
* This service creates a startup task with the current board config and
* passes the task to the electron-main process so that the new window
* can inherit the boards config state of this service.
*
* Note that the state is always set, but new windows might ignore it.
* For example, the new window already has a valid boards config persisted to the local storage.
*/
const USE_INHERITED_CONFIG: Command = {
id: 'arduino-use-inherited-boards-config',
};
/**
* Representation of a ready-to-use board, either the user has configured it or was automatically recognized by the CLI.
* An available board was not necessarily recognized by the CLI (e.g.: it is a 3rd party board) or correctly configured but ready for `verify`.

View File

@@ -0,0 +1,45 @@
import { injectable } from '@theia/core/shared/inversify';
import { SketchesError } from '../../common/protocol';
import {
Command,
CommandRegistry,
SketchContribution,
Sketch,
} from './contribution';
@injectable()
export class DeleteSketch extends SketchContribution {
override registerCommands(registry: CommandRegistry): void {
registry.registerCommand(DeleteSketch.Commands.DELETE_SKETCH, {
execute: (uri: string) => this.deleteSketch(uri),
});
}
private async deleteSketch(uri: string): Promise<void> {
const sketch = await this.loadSketch(uri);
if (!sketch) {
console.info(`Sketch not found at ${uri}. Skipping deletion.`);
return;
}
return this.sketchService.deleteSketch(sketch);
}
private async loadSketch(uri: string): Promise<Sketch | undefined> {
try {
const sketch = await this.sketchService.loadSketch(uri);
return sketch;
} catch (err) {
if (SketchesError.NotFound.is(err)) {
return undefined;
}
throw err;
}
}
}
export namespace DeleteSketch {
export namespace Commands {
export const DELETE_SKETCH: Command = {
id: 'arduino-delete-sketch',
};
}
}

View File

@@ -19,10 +19,11 @@ import {
SketchContribution,
CommandRegistry,
MenuModelRegistry,
URI,
} from './contribution';
import { NotificationCenter } from '../notification-center';
import { Board, SketchRef, SketchContainer } from '../../common/protocol';
import { nls } from '@theia/core/lib/common';
import { nls } from '@theia/core/lib/common/nls';
@injectable()
export abstract class Examples extends SketchContribution {
@@ -150,10 +151,13 @@ export abstract class Examples extends SketchContribution {
return {
execute: async () => {
const sketch = await this.sketchService.cloneExample(uri);
return this.commandService.executeCommand(
OpenSketch.Commands.OPEN_SKETCH.id,
sketch
);
return this.commandService
.executeCommand(OpenSketch.Commands.OPEN_SKETCH.id, sketch)
.then((result) => {
const name = new URI(uri).path.base;
this.sketchService.markAsRecentlyOpened({ name, sourceUri: uri }); // no await
return result;
});
},
};
}

View File

@@ -15,6 +15,7 @@ import { MainMenuManager } from '../../common/main-menu-manager';
import { OpenSketch } from './open-sketch';
import { NotificationCenter } from '../notification-center';
import { nls } from '@theia/core/lib/common';
import { ExampleRef } from '../../common/protocol';
@injectable()
export class OpenRecentSketch extends SketchContribution {
@@ -55,26 +56,30 @@ export class OpenRecentSketch extends SketchContribution {
);
}
private refreshMenu(sketches: Sketch[]): void {
private refreshMenu(sketches: (Sketch | ExampleRef)[]): void {
this.register(sketches);
this.mainMenuManager.update();
}
protected register(sketches: Sketch[]): void {
protected register(sketches: (Sketch | ExampleRef)[]): void {
const order = 0;
for (const sketch of sketches) {
const { uri } = sketch;
const uri = Sketch.is(sketch) ? sketch.uri : sketch.sourceUri;
const toDispose = this.toDisposeBeforeRegister.get(uri);
if (toDispose) {
toDispose.dispose();
}
const command = { id: `arduino-open-recent--${uri}` };
const handler = {
execute: () =>
execute: async () => {
const toOpen = Sketch.is(sketch)
? sketch
: await this.sketchService.cloneExample(sketch.sourceUri);
this.commandRegistry.executeCommand(
OpenSketch.Commands.OPEN_SKETCH.id,
sketch
),
toOpen
);
},
};
this.commandRegistry.registerCommand(command, handler);
this.menuRegistry.registerMenuAction(
@@ -86,7 +91,7 @@ export class OpenRecentSketch extends SketchContribution {
}
);
this.toDisposeBeforeRegister.set(
sketch.uri,
uri,
new DisposableCollection(
Disposable.create(() =>
this.commandRegistry.unregisterCommand(command)

View File

@@ -12,21 +12,19 @@ import {
} from './contribution';
import { nls } from '@theia/core/lib/common';
import { ApplicationShell, NavigatableWidget, Saveable } from '@theia/core/lib/browser';
import { EditorManager } from '@theia/editor/lib/browser';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { CurrentSketch } from '../../common/protocol/sketches-service-client-impl';
import { WorkspaceInput } from '@theia/workspace/lib/browser';
import { StartupTask } from '../../electron-common/startup-task';
import { DeleteSketch } from './delete-sketch';
@injectable()
export class SaveAsSketch extends SketchContribution {
@inject(ApplicationShell)
protected readonly applicationShell: ApplicationShell;
@inject(EditorManager)
protected override readonly editorManager: EditorManager;
private readonly applicationShell: ApplicationShell;
@inject(WindowService)
protected readonly windowService: WindowService;
private readonly windowService: WindowService;
override registerCommands(registry: CommandRegistry): void {
registry.registerCommand(SaveAsSketch.Commands.SAVE_AS_SKETCH, {
@@ -107,21 +105,19 @@ export class SaveAsSketch extends SketchContribution {
this.sketchService.markAsRecentlyOpened(workspaceUri);
}
}
const options: WorkspaceInput & StartupTask.Owner = {
preserveWindow: true,
tasks: [],
};
if (workspaceUri && openAfterMove) {
this.windowService.setSafeToShutDown();
if (wipeOriginal || (openAfterMove && execOnlyIfTemp)) {
// This window will navigate away.
// Explicitly stop the contribution to dispose the file watcher before deleting the temp sketch.
// Otherwise, users might see irrelevant _Unable to watch for file changes in this large workspace._ notification.
// https://github.com/arduino/arduino-ide/issues/39.
this.sketchServiceClient.onStop();
// TODO: consider implementing the temp sketch deletion the following way:
// Open the other sketch with a `delete the temp sketch` startup-task.
this.sketchService.notifyDeleteSketch(sketch); // This is a notification and will execute on the backend.
options.tasks.push({
command: DeleteSketch.Commands.DELETE_SKETCH.id,
args: [sketch.uri],
});
}
this.workspaceService.open(new URI(workspaceUri), {
preserveWindow: true,
});
this.workspaceService.open(new URI(workspaceUri), options);
}
return !!workspaceUri;
}

View File

@@ -4,7 +4,7 @@ import { inject, injectable } from '@theia/core/shared/inversify';
import { FileSystemFrontendContribution } from '@theia/filesystem/lib/browser/filesystem-frontend-contribution';
import { FileChangeType } from '@theia/filesystem/lib/common/files';
import { CurrentSketch } from '../../common/protocol/sketches-service-client-impl';
import { Sketch, SketchContribution, URI } from './contribution';
import { Sketch, SketchContribution } from './contribution';
import { OpenSketchFiles } from './open-sketch-files';
@injectable()
@@ -31,7 +31,6 @@ export class SketchFilesTracker extends SketchContribution {
override onReady(): void {
this.sketchServiceClient.currentSketch().then(async (sketch) => {
if (CurrentSketch.isValid(sketch)) {
this.toDisposeOnStop.push(this.fileService.watch(new URI(sketch.uri)));
this.toDisposeOnStop.push(
this.fileService.onDidFilesChange(async (event) => {
for (const { type, resource } of event.changes) {

View File

@@ -0,0 +1,52 @@
import * as remote from '@theia/core/electron-shared/@electron/remote';
import type { IpcRendererEvent } from '@theia/core/electron-shared/electron';
import { ipcRenderer } from '@theia/core/electron-shared/electron';
import { injectable } from '@theia/core/shared/inversify';
import { StartupTask } from '../../electron-common/startup-task';
import { Contribution } from './contribution';
@injectable()
export class StartupTasks extends Contribution {
override onReady(): void {
ipcRenderer.once(
StartupTask.Messaging.STARTUP_TASKS_SIGNAL,
(_: IpcRendererEvent, args: unknown) => {
console.debug(
`Received the startup tasks from the electron main process. Args: ${JSON.stringify(
args
)}`
);
if (!StartupTask.has(args)) {
console.warn(`Could not detect 'tasks' from the signal. Skipping.`);
return;
}
const tasks = args.tasks;
if (tasks.length) {
console.log(`Executing startup tasks:`);
tasks.forEach(({ command, args = [] }) => {
console.log(
` - '${command}' ${
args.length ? `, args: ${JSON.stringify(args)}` : ''
}`
);
this.commandService
.executeCommand(command, ...args)
.catch((err) =>
console.error(
`Error occurred when executing the startup task '${command}'${
args?.length ? ` with args: '${JSON.stringify(args)}` : ''
}.`,
err
)
);
});
}
}
);
const { id } = remote.getCurrentWindow();
console.debug(
`Signalling app ready event to the electron main process. Sender ID: ${id}.`
);
ipcRenderer.send(StartupTask.Messaging.APP_READY_SIGNAL(id));
}
}

View File

@@ -20,8 +20,7 @@ import {
import { LocalStorageService } from '@theia/core/lib/browser';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
const DOWNLOAD_PAGE_URL =
'https://www.arduino.cc/en/software#experimental-software';
const DOWNLOAD_PAGE_URL = 'https://www.arduino.cc/en/software';
@injectable()
export class IDEUpdaterDialogWidget extends ReactWidget {

View File

@@ -1,7 +1,6 @@
import * as React from '@theia/core/shared/react';
import { Key, KeyCode } from '@theia/core/lib/browser/keys';
import { Board } from '../../../common/protocol/boards-service';
import { isOSX } from '@theia/core/lib/common/os';
import { DisposableCollection, nls } from '@theia/core/lib/common';
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
import { MonitorModel } from '../../monitor-model';
@@ -81,8 +80,7 @@ export class SerialMonitorSendInput extends React.Component<
const port = this.props.boardsServiceProvider.boardsConfig.selectedPort;
return nls.localize(
'arduino/serial/message',
"Message ({0} + Enter to send message to '{1}' on '{2}')",
isOSX ? '⌘' : nls.localize('vscode/keybindingLabels/ctrlKey', 'Ctrl'),
"Message (Enter to send message to '{0}' on '{1}')",
board
? Board.toString(board, {
useFqbn: false,
@@ -110,8 +108,8 @@ export class SerialMonitorSendInput extends React.Component<
protected onKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {
const keyCode = KeyCode.createKeyCode(event.nativeEvent);
if (keyCode) {
const { key, meta, ctrl } = keyCode;
if (key === Key.ENTER && ((isOSX && meta) || (!isOSX && ctrl))) {
const { key } = keyCode;
if (key === Key.ENTER) {
this.onSend();
}
}

View File

@@ -109,7 +109,7 @@ const _Row = ({
}) => {
const timestamp =
(data.timestamp &&
`${dateFormat(data.lines[index].timestamp, 'H:M:ss.l')} -> `) ||
`${dateFormat(data.lines[index].timestamp, 'HH:MM:ss.l')} -> `) ||
'';
return (
(data.lines[index].lineLen && (

View File

@@ -14,6 +14,10 @@ import { MonitorManagerProxyClient } from '../../../common/protocol';
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
import { MonitorModel } from '../../monitor-model';
import { ArduinoToolbar } from '../../toolbar/arduino-toolbar';
import {
CLOSE_PLOTTER_WINDOW,
SHOW_PLOTTER_WINDOW,
} from '../../../common/ipc-communication';
const queryString = require('query-string');
@@ -58,7 +62,7 @@ export class PlotterFrontendContribution extends Contribution {
override onStart(app: FrontendApplication): MaybePromise<void> {
this.url = new Endpoint({ path: '/plotter' }).getRestUrl().toString();
ipcRenderer.on('CLOSE_CHILD_WINDOW', async () => {
ipcRenderer.on(CLOSE_PLOTTER_WINDOW, async () => {
if (!!this.window) {
this.window = null;
}
@@ -96,7 +100,7 @@ export class PlotterFrontendContribution extends Contribution {
async startPlotter(): Promise<void> {
await this.monitorManagerProxy.startMonitor();
if (!!this.window) {
this.window.focus();
ipcRenderer.send(SHOW_PLOTTER_WINDOW);
return;
}
const wsPort = this.monitorManagerProxy.getWebSocketPort();

View File

@@ -1,26 +0,0 @@
import { injectable } from '@theia/core/shared/inversify';
import {
BrowserMainMenuFactory as TheiaBrowserMainMenuFactory,
MenuBarWidget,
} from '@theia/core/lib/browser/menu/browser-menu-plugin';
import { MainMenuManager } from '../../../common/main-menu-manager';
@injectable()
export class BrowserMainMenuFactory
extends TheiaBrowserMainMenuFactory
implements MainMenuManager
{
protected menuBar: MenuBarWidget | undefined;
override createMenuBar(): MenuBarWidget {
this.menuBar = super.createMenuBar();
return this.menuBar;
}
update(): void {
if (this.menuBar) {
this.menuBar.clearMenus();
this.fillMenuBar(this.menuBar);
}
}
}

View File

@@ -1,18 +0,0 @@
import '../../../../src/browser/style/browser-menu.css';
import { ContainerModule } from '@theia/core/shared/inversify';
import {
BrowserMenuBarContribution,
BrowserMainMenuFactory as TheiaBrowserMainMenuFactory,
} from '@theia/core/lib/browser/menu/browser-menu-plugin';
import { MainMenuManager } from '../../../common/main-menu-manager';
import { ArduinoMenuContribution } from './browser-menu-plugin';
import { BrowserMainMenuFactory } from './browser-main-menu-factory';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(BrowserMainMenuFactory).toSelf().inSingletonScope();
bind(MainMenuManager).toService(BrowserMainMenuFactory);
rebind(TheiaBrowserMainMenuFactory).toService(BrowserMainMenuFactory);
rebind(BrowserMenuBarContribution)
.to(ArduinoMenuContribution)
.inSingletonScope();
});

View File

@@ -1,10 +0,0 @@
import { DefaultWindowService as TheiaDefaultWindowService } from '@theia/core/lib/browser/window/default-window-service';
import { ContainerModule } from '@theia/core/shared/inversify';
import { DefaultWindowService } from './default-window-service';
import { WindowServiceExt } from './window-service-ext';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(DefaultWindowService).toSelf().inSingletonScope();
rebind(TheiaDefaultWindowService).toService(DefaultWindowService);
bind(WindowServiceExt).toService(DefaultWindowService);
});

View File

@@ -1,17 +0,0 @@
import { DefaultWindowService as TheiaDefaultWindowService } from '@theia/core/lib/browser/window/default-window-service';
import { injectable } from '@theia/core/shared/inversify';
import { WindowServiceExt } from './window-service-ext';
@injectable()
export class DefaultWindowService
extends TheiaDefaultWindowService
implements WindowServiceExt
{
/**
* The default implementation always resolves to `true`.
* IDE2 does not use it. It's currently an electron-only app.
*/
async isFirstWindow(): Promise<boolean> {
return true;
}
}

View File

@@ -1,7 +1,10 @@
import type { StartupTask } from '../../../electron-common/startup-task';
export const WindowServiceExt = Symbol('WindowServiceExt');
export interface WindowServiceExt {
/**
* Returns with a promise that resolves to `true` if the current window is the first window.
*/
isFirstWindow(): Promise<boolean>;
reload(options?: StartupTask.Owner): void;
}

View File

@@ -1,54 +1,41 @@
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { injectable, inject } from '@theia/core/shared/inversify';
import { injectable, inject, named } from '@theia/core/shared/inversify';
import URI from '@theia/core/lib/common/uri';
import { EditorWidget } from '@theia/editor/lib/browser';
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
import { MessageService } from '@theia/core/lib/common/message-service';
import { ApplicationServer } from '@theia/core/lib/common/application-protocol';
import { FrontendApplication } from '@theia/core/lib/browser/frontend-application';
import { FocusTracker, Widget } from '@theia/core/lib/browser';
import { DEFAULT_WINDOW_HASH } from '@theia/core/lib/common/window';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
import {
DEFAULT_WINDOW_HASH,
NewWindowOptions,
} from '@theia/core/lib/common/window';
import {
WorkspaceInput,
WorkspaceService as TheiaWorkspaceService,
} from '@theia/workspace/lib/browser/workspace-service';
import { ConfigService } from '../../../common/protocol/config-service';
import {
SketchesService,
Sketch,
} from '../../../common/protocol/sketches-service';
import { BoardsServiceProvider } from '../../boards/boards-service-provider';
import { BoardsConfig } from '../../boards/boards-config';
import { FileStat } from '@theia/filesystem/lib/common/files';
import {
StartupTask,
StartupTasks,
} from '../../widgets/sketchbook/startup-task';
import { setURL } from '../../utils/window';
StartupTaskProvider,
} from '../../../electron-common/startup-task';
import { WindowServiceExt } from '../core/window-service-ext';
import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
@injectable()
export class WorkspaceService extends TheiaWorkspaceService {
@inject(SketchesService)
protected readonly sketchService: SketchesService;
@inject(ConfigService)
protected readonly configService: ConfigService;
@inject(LabelProvider)
protected override readonly labelProvider: LabelProvider;
@inject(MessageService)
protected override readonly messageService: MessageService;
private readonly sketchService: SketchesService;
@inject(ApplicationServer)
protected readonly applicationServer: ApplicationServer;
@inject(FrontendApplicationStateService)
protected readonly appStateService: FrontendApplicationStateService;
@inject(BoardsServiceProvider)
protected readonly boardsServiceProvider: BoardsServiceProvider;
private readonly applicationServer: ApplicationServer;
@inject(WindowServiceExt)
private readonly windowServiceExt: WindowServiceExt;
@inject(ContributionProvider)
@named(StartupTaskProvider)
private readonly providers: ContributionProvider<StartupTaskProvider>;
private version?: string;
@@ -156,27 +143,33 @@ export class WorkspaceService extends TheiaWorkspaceService {
}
protected override reloadWindow(options?: WorkspaceInput): void {
if (StartupTasks.WorkspaceInput.is(options)) {
setURL(StartupTask.append(options.tasks, new URL(window.location.href)));
}
super.reloadWindow();
const tasks = this.tasks(options);
this.setURLFragment(this._workspace?.resource.path.toString() || '');
this.windowServiceExt.reload({ tasks });
}
protected override openNewWindow(
workspacePath: string,
options?: WorkspaceInput
): void {
const { boardsConfig } = this.boardsServiceProvider;
let url = BoardsConfig.Config.setConfig(
boardsConfig,
new URL(window.location.href)
); // Set the current boards config for the new browser window.
url.hash = workspacePath;
if (StartupTasks.WorkspaceInput.is(options)) {
url = StartupTask.append(options.tasks, url);
}
const tasks = this.tasks(options);
const url = new URL(window.location.href);
url.hash = encodeURI(workspacePath);
this.windowService.openNewWindow(
url.toString(),
Object.assign({} as NewWindowOptions, { tasks })
);
}
this.windowService.openNewWindow(url.toString());
private tasks(options?: WorkspaceInput): StartupTask[] {
const tasks = this.providers
.getContributions()
.map((contribution) => contribution.tasks())
.reduce((prev, curr) => prev.concat(curr), []);
if (StartupTask.has(options)) {
tasks.push(...options.tasks);
}
return tasks;
}
protected onCurrentWidgetChange({

View File

@@ -1,92 +0,0 @@
import { injectable } from '@theia/core/shared/inversify';
import { WorkspaceInput as TheiaWorkspaceInput } from '@theia/workspace/lib/browser';
import { Contribution } from '../../contributions/contribution';
import { setURL } from '../../utils/window';
@injectable()
export class StartupTasks extends Contribution {
override onReady(): void {
const tasks = StartupTask.get(new URL(window.location.href));
console.log(`Executing startup tasks: ${JSON.stringify(tasks)}`);
tasks.forEach(({ command, args = [] }) =>
this.commandService
.executeCommand(command, ...args)
.catch((err) =>
console.error(
`Error occurred when executing the startup task '${command}'${
args?.length ? ` with args: '${JSON.stringify(args)}` : ''
}.`,
err
)
)
);
if (tasks.length) {
// Remove the startup tasks after the execution.
// Otherwise, IDE2 executes them again on a window reload event.
setURL(StartupTask.set([], new URL(window.location.href)));
console.info(`Removed startup tasks from URL.`);
}
}
}
export interface StartupTask {
command: string;
/**
* Must be JSON serializable.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args?: any[];
}
export namespace StartupTask {
const QUERY = 'startupTasks';
export function is(arg: unknown): arg is StartupTasks {
if (typeof arg === 'object') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const object = arg as any;
return 'command' in object && typeof object['command'] === 'string';
}
return false;
}
export function get(url: URL): StartupTask[] {
const { searchParams } = url;
const encodedTasks = searchParams.get(QUERY);
if (encodedTasks) {
const rawTasks = decodeURIComponent(encodedTasks);
const tasks = JSON.parse(rawTasks);
if (Array.isArray(tasks)) {
return tasks.filter((task) => {
if (StartupTask.is(task)) {
return true;
}
console.warn(`Was not a task: ${JSON.stringify(task)}. Ignoring.`);
return false;
});
} else {
debugger;
console.warn(`Startup tasks was not an array: ${rawTasks}. Ignoring.`);
}
}
return [];
}
export function set(tasks: StartupTask[], url: URL): URL {
const copy = new URL(url);
copy.searchParams.set(QUERY, encodeURIComponent(JSON.stringify(tasks)));
return copy;
}
export function append(tasks: StartupTask[], url: URL): URL {
return set([...get(url), ...tasks], url);
}
}
export namespace StartupTasks {
export interface WorkspaceInput extends TheiaWorkspaceInput {
tasks: StartupTask[];
}
export namespace WorkspaceInput {
export function is(
input: (TheiaWorkspaceInput & Partial<WorkspaceInput>) | undefined
): input is WorkspaceInput {
return !!input && !!input.tasks;
}
}
}

View File

@@ -0,0 +1,2 @@
export const SHOW_PLOTTER_WINDOW = 'SHOW_PLOTTER_WINDOW';
export const CLOSE_PLOTTER_WINDOW = 'CLOSE_PLOTTER_WINDOW';

View File

@@ -5,6 +5,7 @@ import type {
Config,
ProgressMessage,
Sketch,
ExampleRef,
} from '../protocol';
import type { LibraryPackage } from './library-service';
@@ -27,7 +28,9 @@ export interface NotificationServiceClient {
notifyLibraryDidInstall(event: { item: LibraryPackage }): void;
notifyLibraryDidUninstall(event: { item: LibraryPackage }): void;
notifyAttachedBoardsDidChange(event: AttachedBoardsChangeEvent): void;
notifyRecentSketchesDidChange(event: { sketches: Sketch[] }): void;
notifyRecentSketchesDidChange(event: {
sketches: (Sketch | ExampleRef)[];
}): void;
}
export const NotificationServicePath = '/services/notification-service';

View File

@@ -165,15 +165,6 @@ export class SketchesServiceClientImpl
.reachedState('started_contributions')
.then(async () => {
const currentSketch = await this.loadCurrentSketch();
if (CurrentSketch.isValid(currentSketch)) {
this.toDispose.pushAll([
// Watch the file changes of the current sketch
this.fileService.watch(new URI(currentSketch.uri), {
recursive: true,
excludes: [],
}),
]);
}
this.useCurrentSketch(currentSketch);
});
}

View File

@@ -78,12 +78,12 @@ export interface SketchesService {
/**
* Marks the sketch with the given URI as recently opened. It does nothing if the sketch is temp or not valid.
*/
markAsRecentlyOpened(uri: string): Promise<void>;
markAsRecentlyOpened(uriOrRef: string | ExampleRef): Promise<void>;
/**
* Resolves to an array of sketches in inverse chronological order. The newest is the first.
*/
recentlyOpenedSketches(): Promise<Sketch[]>;
recentlyOpenedSketches(): Promise<(Sketch | ExampleRef)[]>;
/**
* Archives the sketch, resolves to the archive URI.
@@ -97,9 +97,30 @@ export interface SketchesService {
getIdeTempFolderUri(sketch: Sketch): Promise<string>;
/**
* Notifies the backend to recursively delete the sketch folder with all its content.
* Recursively deletes the sketch folder with all its content.
*/
notifyDeleteSketch(sketch: Sketch): void;
deleteSketch(sketch: Sketch): Promise<void>;
}
export interface ExampleRef {
/**
* Name of the example.
*/
readonly name: string;
/**
* This is the location where the example is. IDE2 will clone the sketch from this location.
*/
readonly sourceUri: string;
}
export namespace ExampleRef {
export function is(arg: unknown): arg is ExampleRef {
return (
(arg as ExampleRef).name !== undefined &&
typeof (arg as ExampleRef).name === 'string' &&
(arg as ExampleRef).sourceUri !== undefined &&
typeof (arg as ExampleRef).sourceUri === 'string'
);
}
}
export interface SketchRef {

View File

@@ -1,10 +1,14 @@
import * as remote from '@theia/core/electron-shared/@electron/remote';
import { ipcRenderer } from '@theia/core/electron-shared/electron';
import {
ConnectionStatus,
ConnectionStatusService,
} from '@theia/core/lib/browser/connection-status-service';
import { nls } from '@theia/core/lib/common';
import { Deferred } from '@theia/core/lib/common/promise-util';
import { NewWindowOptions } from '@theia/core/lib/common/window';
import { ElectronWindowService as TheiaElectronWindowService } from '@theia/core/lib/electron-browser/window/electron-window-service';
import { RELOAD_REQUESTED_SIGNAL } from '@theia/core/lib/electron-common/messaging/electron-messages';
import {
inject,
injectable,
@@ -12,6 +16,7 @@ import {
} from '@theia/core/shared/inversify';
import { WindowServiceExt } from '../../../browser/theia/core/window-service-ext';
import { ElectronMainWindowServiceExt } from '../../../electron-common/electron-main-window-service-ext';
import { StartupTask } from '../../../electron-common/startup-task';
@injectable()
export class ElectronWindowService
@@ -60,14 +65,30 @@ export class ElectronWindowService
return response === 0; // 'Yes', close the window.
}
private _firstWindow: boolean | undefined;
private _firstWindow: Deferred<boolean> | undefined;
async isFirstWindow(): Promise<boolean> {
if (this._firstWindow === undefined) {
this._firstWindow = new Deferred<boolean>();
const windowId = remote.getCurrentWindow().id; // This is expensive and synchronous so we check it once per FE.
this._firstWindow = await this.mainWindowServiceExt.isFirstWindow(
windowId
);
this.mainWindowServiceExt
.isFirstWindow(windowId)
.then((firstWindow) => this._firstWindow?.resolve(firstWindow));
}
return this._firstWindow.promise;
}
// Overridden because the default Theia implementation destroys the additional properties of the `options` arg, such as `tasks`.
override openNewWindow(url: string, options?: NewWindowOptions): undefined {
return this.delegate.openNewWindow(url, options);
}
// Overridden to support optional task owner params and make `tsc` happy.
override reload(options?: StartupTask.Owner): void {
if (options?.tasks && options.tasks.length) {
const { tasks } = options;
ipcRenderer.send(RELOAD_REQUESTED_SIGNAL, { tasks });
} else {
ipcRenderer.send(RELOAD_REQUESTED_SIGNAL);
}
return this._firstWindow;
}
}

View File

@@ -0,0 +1,50 @@
export interface StartupTask {
command: string;
/**
* Must be JSON serializable.
* See the restrictions [here](https://www.electronjs.org/docs/latest/api/web-contents#contentssendchannel-args).
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args?: any[];
}
export namespace StartupTask {
export function is(arg: unknown): arg is StartupTask {
if (typeof arg === 'object') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const object = arg as any;
return (
'command' in object &&
typeof object['command'] === 'string' &&
(!('args' in object) || Array.isArray(object['args']))
);
}
return false;
}
export function has(arg: unknown): arg is unknown & Owner {
if (typeof arg === 'object') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const object = arg as any;
return (
'tasks' in object &&
Array.isArray(object['tasks']) &&
object['tasks'].every(is)
);
}
return false;
}
export namespace Messaging {
export const STARTUP_TASKS_SIGNAL = 'arduino/startupTasks';
export function APP_READY_SIGNAL(id: number): string {
return `arduino/appReady${id}`;
}
}
export interface Owner {
readonly tasks: StartupTask[];
}
}
export const StartupTaskProvider = Symbol('StartupTaskProvider');
export interface StartupTaskProvider {
tasks(): StartupTask[];
}

View File

@@ -12,12 +12,8 @@ import {
IDEUpdaterClient,
IDEUpdaterPath,
} from '../common/protocol/ide-updater';
import {
ElectronMainWindowServiceExt,
electronMainWindowServiceExtPath,
} from '../electron-common/electron-main-window-service-ext';
import { electronMainWindowServiceExtPath } from '../electron-common/electron-main-window-service-ext';
import { IsTempSketch } from '../node/is-temp-sketch';
import { ElectronMainWindowServiceExtImpl } from './electron-main-window-service-ext-impl';
import { IDEUpdaterImpl } from './ide-updater/ide-updater-impl';
import { ElectronMainApplication } from './theia/electron-main-application';
import { ElectronMainWindowServiceImpl } from './theia/electron-main-window-service';
@@ -52,14 +48,11 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(TheiaElectronWindow).toSelf();
rebind(DefaultTheiaElectronWindow).toService(TheiaElectronWindow);
bind(ElectronMainWindowServiceExt)
.to(ElectronMainWindowServiceExtImpl)
.inSingletonScope();
bind(ElectronConnectionHandler)
.toDynamicValue(
(context) =>
new JsonRpcConnectionHandler(electronMainWindowServiceExtPath, () =>
context.container.get(ElectronMainWindowServiceExt)
context.container.get(ElectronMainWindowServiceImpl)
)
)
.inSingletonScope();

View File

@@ -1,15 +0,0 @@
import { inject, injectable } from '@theia/core/shared/inversify';
import { ElectronMainWindowServiceExt } from '../electron-common/electron-main-window-service-ext';
import { ElectronMainApplication } from './theia/electron-main-application';
@injectable()
export class ElectronMainWindowServiceExtImpl
implements ElectronMainWindowServiceExt
{
@inject(ElectronMainApplication)
private readonly app: ElectronMainApplication;
async isFirstWindow(windowId: number): Promise<boolean> {
return this.app.firstWindowId === windowId;
}
}

View File

@@ -23,6 +23,10 @@ import * as os from '@theia/core/lib/common/os';
import { Restart } from '@theia/core/lib/electron-common/messaging/electron-messages';
import { TheiaBrowserWindowOptions } from '@theia/core/lib/electron-main/theia-electron-window';
import { IsTempSketch } from '../../node/is-temp-sketch';
import {
CLOSE_PLOTTER_WINDOW,
SHOW_PLOTTER_WINDOW,
} from '../../common/ipc-communication';
app.commandLine.appendSwitch('disable-http-cache');
@@ -324,15 +328,21 @@ export class ElectronMainApplication extends TheiaElectronMainApplication {
webPreferences: {
devTools: true,
nativeWindowOpen: true,
openerId: electronWindow?.webContents.id,
openerId: electronWindow.webContents.id,
},
});
event.newGuest = new BrowserWindow(options);
const showPlotterWindow = () => {
event.newGuest?.show();
};
ipcMain.on(SHOW_PLOTTER_WINDOW, showPlotterWindow);
event.newGuest.setMenu(null);
event.newGuest?.on('closed', () => {
electronWindow?.webContents.send('CLOSE_CHILD_WINDOW');
event.newGuest.on('closed', () => {
ipcMain.removeListener(SHOW_PLOTTER_WINDOW, showPlotterWindow);
electronWindow.webContents.send(CLOSE_PLOTTER_WINDOW);
});
event.newGuest?.loadURL(url);
event.newGuest.loadURL(url);
}
}
);

View File

@@ -1,34 +1,63 @@
import { inject, injectable } from '@theia/core/shared/inversify';
import type { NewWindowOptions } from '@theia/core/lib/common/window';
import type { BrowserWindow } from '@theia/core/electron-shared/electron';
import { ElectronMainWindowServiceImpl as TheiaElectronMainWindowService } from '@theia/core/lib/electron-main/electron-main-window-service-impl';
import { inject, injectable } from '@theia/core/shared/inversify';
import { ElectronMainWindowServiceExt } from '../../electron-common/electron-main-window-service-ext';
import { StartupTask } from '../../electron-common/startup-task';
import { ElectronMainApplication } from './electron-main-application';
import { NewWindowOptions } from '@theia/core/lib/common/window';
import { load } from './window';
@injectable()
export class ElectronMainWindowServiceImpl extends TheiaElectronMainWindowService {
export class ElectronMainWindowServiceImpl
extends TheiaElectronMainWindowService
implements ElectronMainWindowServiceExt
{
@inject(ElectronMainApplication)
protected override readonly app: ElectronMainApplication;
override openNewWindow(url: string, { external }: NewWindowOptions): undefined {
if (!external) {
const sanitizedUrl = this.sanitize(url);
const existing = this.app.browserWindows.find(
(window) => this.sanitize(window.webContents.getURL()) === sanitizedUrl
);
if (existing) {
existing.focus();
return;
}
}
return super.openNewWindow(url, { external });
async isFirstWindow(windowId: number): Promise<boolean> {
return this.app.firstWindowId === windowId;
}
private sanitize(url: string): string {
const copy = new URL(url);
const searchParams: string[] = [];
copy.searchParams.forEach((_, key) => searchParams.push(key));
for (const param of searchParams) {
copy.searchParams.delete(param);
override openNewWindow(url: string, options: NewWindowOptions): undefined {
// External window has highest precedence.
if (options?.external) {
return super.openNewWindow(url, options);
}
return copy.toString();
// Look for existing window with the same URL and focus it.
const existing = this.app.browserWindows.find(
({ webContents }) => webContents.getURL() === url
);
if (existing) {
existing.focus();
return undefined;
}
// Create new window and share the startup tasks.
if (StartupTask.has(options)) {
const { tasks } = options;
this.app.createWindow().then((electronWindow) => {
this.loadURL(electronWindow, url).then(() => {
electronWindow.webContents.send(
StartupTask.Messaging.STARTUP_TASKS_SIGNAL,
{ tasks }
);
});
});
return undefined;
}
// Default.
return super.openNewWindow(url, options);
}
private loadURL(
electronWindow: BrowserWindow,
url: string
): Promise<BrowserWindow> {
return load(electronWindow, (electronWindow) =>
electronWindow.loadURL(url)
);
}
}

View File

@@ -1,12 +1,15 @@
import { injectable } from '@theia/core/shared/inversify';
import { ipcMain, IpcMainEvent } from '@theia/electron/shared/electron';
import { StopReason } from '@theia/core/lib/electron-common/messaging/electron-messages';
import {
RELOAD_REQUESTED_SIGNAL,
StopReason,
} from '@theia/core/lib/electron-common/messaging/electron-messages';
import { TheiaElectronWindow as DefaultTheiaElectronWindow } from '@theia/core/lib/electron-main/theia-electron-window';
import { FileUri } from '@theia/core/lib/node';
import URI from '@theia/core/lib/common/uri';
import { FrontendApplicationState } from '@theia/core/lib/common/frontend-application-state';
import { createDisposableListener } from '@theia/core/lib/electron-main/event-utils';
import { APPLICATION_STATE_CHANGE_SIGNAL } from '@theia/core/lib/electron-common/messaging/electron-messages';
import { StartupTask } from '../../electron-common/startup-task';
import { load } from './window';
@injectable()
export class TheiaElectronWindow extends DefaultTheiaElectronWindow {
@@ -38,30 +41,42 @@ export class TheiaElectronWindow extends DefaultTheiaElectronWindow {
return false;
}
// Note: does the same as the Theia impl, but logs state changes.
protected override trackApplicationState(): void {
protected override reload(tasks?: StartupTask[]): void {
this.handleStopRequest(() => {
this.applicationState = 'init';
if (tasks && tasks.length) {
load(this._window, (electronWindow) => electronWindow.reload()).then(
(electronWindow) =>
electronWindow.webContents.send(
StartupTask.Messaging.STARTUP_TASKS_SIGNAL,
{ tasks }
)
);
} else {
this._window.reload();
}
}, StopReason.Reload);
}
protected override attachReloadListener(): void {
createDisposableListener(
ipcMain,
APPLICATION_STATE_CHANGE_SIGNAL,
(e: IpcMainEvent, state: FrontendApplicationState) => {
console.log(
'app-state-change',
`>>> new app state <${state} was received from sender <${e.sender.id}>. current window ID: ${this._window.id}`
);
RELOAD_REQUESTED_SIGNAL,
(e: IpcMainEvent, arg: unknown) => {
if (this.isSender(e)) {
this.applicationState = state;
console.log(
'app-state-change',
`<<< new app state is <${this.applicationState}> for window <${this._window.id}>`
);
} else {
console.log(
'app-state-change',
`<<< new app state <${state}> is ignored from <${e.sender.id}>. current window ID is <${this._window.id}>`
);
if (StartupTask.has(arg)) {
this.reload(arg.tasks);
} else {
this.reload();
}
}
},
this.toDispose
);
}
// https://github.com/eclipse-theia/theia/issues/11600#issuecomment-1240657481
protected override isSender(e: IpcMainEvent): boolean {
return e.sender.id === this._window.webContents.id;
}
}

View File

@@ -0,0 +1,33 @@
import { MaybePromise } from '@theia/core';
import type { IpcMainEvent } from '@theia/core/electron-shared/electron';
import { BrowserWindow, ipcMain } from '@theia/core/electron-shared/electron';
import { DisposableCollection } from '@theia/core/lib/common/disposable';
import { createDisposableListener } from '@theia/core/lib/electron-main/event-utils';
import { StartupTask } from '../../electron-common/startup-task';
/**
* Should be used to load (URL) or reload a window. The returning promise will resolve
* when the app is ready to receive startup tasks.
*/
export async function load(
electronWindow: BrowserWindow,
doLoad: (electronWindow: BrowserWindow) => MaybePromise<void>
): Promise<BrowserWindow> {
const { id } = electronWindow;
const toDispose = new DisposableCollection();
const channel = StartupTask.Messaging.APP_READY_SIGNAL(id);
return new Promise<BrowserWindow>((resolve, reject) => {
toDispose.push(
createDisposableListener(
ipcMain,
channel,
({ sender: webContents }: IpcMainEvent) => {
if (webContents.id === electronWindow.webContents.id) {
resolve(electronWindow);
}
}
)
);
Promise.resolve(doLoad(electronWindow)).catch(reject);
}).finally(() => toDispose.dispose());
}

View File

@@ -1,4 +1,4 @@
import { ContainerModule } from '@theia/core/shared/inversify';
import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
import { ArduinoDaemonImpl } from './arduino-daemon-impl';
import {
ArduinoFirmwareUploader,
@@ -110,6 +110,7 @@ import {
SurveyNotificationServicePath,
} from '../common/protocol/survey-service';
import { IsTempSketch } from './is-temp-sketch';
import { rebindNsfwFileSystemWatcher } from './theia/filesystem/nsfw-watcher/nsfw-bindings';
export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(BackendApplication).toSelf().inSingletonScope();
@@ -288,6 +289,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
)
)
.inSingletonScope();
rebindNsfwFileSystemWatcher(rebind);
// Output service per connection.
bind(ConnectionContainerModule).toConstantValue(
@@ -325,58 +327,14 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
})
);
// Logger for the Arduino daemon
bind(ILogger)
.toDynamicValue((ctx) => {
const parentLogger = ctx.container.get<ILogger>(ILogger);
return parentLogger.child('daemon');
})
.inSingletonScope()
.whenTargetNamed('daemon');
// Logger for the Arduino daemon
bind(ILogger)
.toDynamicValue((ctx) => {
const parentLogger = ctx.container.get<ILogger>(ILogger);
return parentLogger.child('fwuploader');
})
.inSingletonScope()
.whenTargetNamed('fwuploader');
// Logger for the "serial discovery".
bind(ILogger)
.toDynamicValue((ctx) => {
const parentLogger = ctx.container.get<ILogger>(ILogger);
return parentLogger.child('discovery-log'); // TODO: revert
})
.inSingletonScope()
.whenTargetNamed('discovery-log'); // TODO: revert
// Logger for the CLI config service. From the CLI config (FS path aware), we make a URI-aware app config.
bind(ILogger)
.toDynamicValue((ctx) => {
const parentLogger = ctx.container.get<ILogger>(ILogger);
return parentLogger.child('config');
})
.inSingletonScope()
.whenTargetNamed('config');
// Logger for the monitor manager and its services
bind(ILogger)
.toDynamicValue((ctx) => {
const parentLogger = ctx.container.get<ILogger>(ILogger);
return parentLogger.child(MonitorManagerName);
})
.inSingletonScope()
.whenTargetNamed(MonitorManagerName);
bind(ILogger)
.toDynamicValue((ctx) => {
const parentLogger = ctx.container.get<ILogger>(ILogger);
return parentLogger.child(MonitorServiceName);
})
.inSingletonScope()
.whenTargetNamed(MonitorServiceName);
[
'daemon', // Logger for the Arduino daemon
'fwuploader', // Arduino Firmware uploader
'discovery-log', // Boards discovery
'config', // Logger for the CLI config reading and manipulation
MonitorManagerName, // Logger for the monitor manager and its services
MonitorServiceName,
].forEach((name) => bindChildLogger(bind, name));
// Remote sketchbook bindings
bind(AuthenticationServiceImpl).toSelf().inSingletonScope();
@@ -423,3 +381,12 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
bind(IsTempSketch).toSelf().inSingletonScope();
});
function bindChildLogger(bind: interfaces.Bind, name: string): void {
bind(ILogger)
.toDynamicValue(({ container }) =>
container.get<ILogger>(ILogger).child(name)
)
.inSingletonScope()
.whenTargetNamed(name);
}

View File

@@ -8,6 +8,7 @@ import type {
Config,
Sketch,
ProgressMessage,
ExampleRef,
} from '../common/protocol';
@injectable()
@@ -76,7 +77,9 @@ export class NotificationServiceServerImpl
this.clients.forEach((client) => client.notifyConfigDidChange(event));
}
notifyRecentSketchesDidChange(event: { sketches: Sketch[] }): void {
notifyRecentSketchesDidChange(event: {
sketches: (Sketch | ExampleRef)[];
}): void {
this.clients.forEach((client) =>
client.notifyRecentSketchesDidChange(event)
);

View File

@@ -16,6 +16,7 @@ import {
SketchRef,
SketchContainer,
SketchesError,
ExampleRef,
} from '../common/protocol/sketches-service';
import { NotificationServiceServerImpl } from './notification-service-server';
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
@@ -257,9 +258,7 @@ export class SketchesServiceImpl
.then((uri) => path.join(FileUri.fsPath(uri), 'recent-sketches.json'));
}
private async loadRecentSketches(
fsPath: string
): Promise<Record<string, number>> {
private async loadRecentSketches(fsPath: string): Promise<RecentSketches> {
let data: Record<string, number> = {};
try {
const raw = await promisify(fs.readFile)(fsPath, {
@@ -270,7 +269,9 @@ export class SketchesServiceImpl
return data;
}
async markAsRecentlyOpened(uri: string): Promise<void> {
async markAsRecentlyOpened(uriOrRef: string | ExampleRef): Promise<void> {
const isExample = typeof uriOrRef !== 'string';
const uri = isExample ? uriOrRef.sourceUri : uriOrRef;
let sketch: Sketch | undefined = undefined;
try {
sketch = await this.loadSketch(uri);
@@ -284,15 +285,23 @@ export class SketchesServiceImpl
const fsPath = await this.recentSketchesFsPath;
const data = await this.loadRecentSketches(fsPath);
const now = Date.now();
data[sketch.uri] = now;
data[sketch.uri] = isExample ? { type: 'example', mtimeMs: now } : now;
let toDeleteUri: string | undefined = undefined;
if (Object.keys(data).length > 10) {
let min = Number.MAX_SAFE_INTEGER;
for (const uri of Object.keys(data)) {
if (min > data[uri]) {
min = data[uri];
toDeleteUri = uri;
const value = data[uri];
if (typeof value === 'number') {
if (min > value) {
min = value;
toDeleteUri = uri;
}
} else {
if (min > value.mtimeMs) {
min = value.mtimeMs;
toDeleteUri = uri;
}
}
}
}
@@ -307,13 +316,13 @@ export class SketchesServiceImpl
);
}
async recentlyOpenedSketches(): Promise<Sketch[]> {
async recentlyOpenedSketches(): Promise<(Sketch | ExampleRef)[]> {
const configDirUri = await this.envVariableServer.getConfigDirUri();
const fsPath = path.join(
FileUri.fsPath(configDirUri),
'recent-sketches.json'
);
let data: Record<string, number> = {};
let data: RecentSketches = {};
try {
const raw = await promisify(fs.readFile)(fsPath, {
encoding: 'utf8',
@@ -321,14 +330,25 @@ export class SketchesServiceImpl
data = JSON.parse(raw);
} catch {}
const sketches: SketchWithDetails[] = [];
for (const uri of Object.keys(data).sort(
(left, right) => data[right] - data[left]
)) {
try {
const sketch = await this.loadSketch(uri);
sketches.push(sketch);
} catch {}
const sketches: (Sketch | ExampleRef)[] = [];
for (const uri of Object.keys(data).sort((left, right) => {
const leftValue = data[left];
const rightValue = data[right];
const leftMtimeMs =
typeof leftValue === 'number' ? leftValue : leftValue.mtimeMs;
const rightMtimeMs =
typeof rightValue === 'number' ? rightValue : rightValue.mtimeMs;
return leftMtimeMs - rightMtimeMs;
})) {
const value = data[uri];
if (typeof value === 'number') {
try {
const sketch = await this.loadSketch(uri);
sketches.push(sketch);
} catch {}
} else {
sketches.push({ name: new URI(uri).path.base, sourceUri: uri });
}
}
return sketches;
@@ -417,9 +437,9 @@ void loop() {
* For example, on Windows, instead of getting an [8.3 filename](https://en.wikipedia.org/wiki/8.3_filename), callers will get a fully resolved path.
* `C:\\Users\\KITTAA~1\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2022615-21100-iahybb.yyvh\\sketch_jul15a` will be `C:\\Users\\kittaakos\\AppData\\Local\\Temp\\.arduinoIDE-unsaved2022615-21100-iahybb.yyvh\\sketch_jul15a`
*/
private createTempFolder(): Promise<string> {
private createTempFolder(prefix: string = TempSketchPrefix): Promise<string> {
return new Promise<string>((resolve, reject) => {
temp.mkdir({ prefix: TempSketchPrefix }, (createError, dirPath) => {
temp.mkdir({ prefix }, (createError, dirPath) => {
if (createError) {
reject(createError);
return;
@@ -561,14 +581,18 @@ void loop() {
return path.join(os.tmpdir(), `arduino-ide2-${suffix}`);
}
notifyDeleteSketch(sketch: Sketch): void {
const sketchPath = FileUri.fsPath(sketch.uri);
fs.rm(sketchPath, { recursive: true, maxRetries: 5 }, (error) => {
if (error) {
console.error(`Failed to delete sketch at ${sketchPath}.`, error);
} else {
console.error(`Successfully delete sketch at ${sketchPath}.`);
}
async deleteSketch(sketch: Sketch): Promise<void> {
return new Promise<void>((resolve, reject) => {
const sketchPath = FileUri.fsPath(sketch.uri);
fs.rm(sketchPath, { recursive: true, maxRetries: 5 }, (error) => {
if (error) {
console.error(`Failed to delete sketch at ${sketchPath}.`, error);
reject(error);
} else {
console.log(`Successfully deleted sketch at ${sketchPath}.`);
resolve();
}
});
});
}
}
@@ -630,3 +654,8 @@ function sketchIndexToLetters(num: number): string {
} while (pow > 0);
return out;
}
type RecentSketches = Record<
string,
number | { type: 'example'; mtimeMs: number }
>;

View File

@@ -0,0 +1,31 @@
import * as yargs from '@theia/core/shared/yargs';
import { JsonRpcProxyFactory } from '@theia/core';
import { NoDelayDisposalTimeoutNsfwFileSystemWatcherService } from './nsfw-filesystem-service';
import type { IPCEntryPoint } from '@theia/core/lib/node/messaging/ipc-protocol';
import type { FileSystemWatcherServiceClient } from '@theia/filesystem/lib/common/filesystem-watcher-protocol';
const options: {
verbose: boolean;
} = yargs
.option('verbose', {
default: false,
alias: 'v',
type: 'boolean',
})
.option('nsfwOptions', {
alias: 'o',
type: 'string',
coerce: JSON.parse,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
}).argv as any;
export default <IPCEntryPoint>((connection) => {
const server = new NoDelayDisposalTimeoutNsfwFileSystemWatcherService(
options
);
const factory = new JsonRpcProxyFactory<FileSystemWatcherServiceClient>(
server
);
server.setClient(factory.createProxy());
factory.listen(connection);
});

View File

@@ -0,0 +1,42 @@
import { join } from 'path';
import { interfaces } from '@theia/core/shared/inversify';
import {
NsfwFileSystemWatcherServiceProcessOptions,
NSFW_SINGLE_THREADED,
spawnNsfwFileSystemWatcherServiceProcess,
} from '@theia/filesystem/lib/node/filesystem-backend-module';
import { FileSystemWatcherService } from '@theia/filesystem/lib/common/filesystem-watcher-protocol';
import { NsfwFileSystemWatcherServerOptions } from '@theia/filesystem/lib/node/nsfw-watcher/nsfw-filesystem-service';
import { FileSystemWatcherServiceDispatcher } from '@theia/filesystem/lib/node/filesystem-watcher-dispatcher';
import { NoDelayDisposalTimeoutNsfwFileSystemWatcherService } from './nsfw-filesystem-service';
export function rebindNsfwFileSystemWatcher(rebind: interfaces.Rebind): void {
rebind<NsfwFileSystemWatcherServiceProcessOptions>(
NsfwFileSystemWatcherServiceProcessOptions
).toConstantValue({
entryPoint: join(__dirname, 'index.js'),
});
rebind<FileSystemWatcherService>(FileSystemWatcherService)
.toDynamicValue((context) =>
NSFW_SINGLE_THREADED
? createNsfwFileSystemWatcherService(context)
: spawnNsfwFileSystemWatcherServiceProcess(context)
)
.inSingletonScope();
}
function createNsfwFileSystemWatcherService({
container,
}: interfaces.Context): FileSystemWatcherService {
const options = container.get<NsfwFileSystemWatcherServerOptions>(
NsfwFileSystemWatcherServerOptions
);
const dispatcher = container.get<FileSystemWatcherServiceDispatcher>(
FileSystemWatcherServiceDispatcher
);
const server = new NoDelayDisposalTimeoutNsfwFileSystemWatcherService(
options
);
server.setClient(dispatcher);
return server;
}

View File

@@ -0,0 +1,32 @@
import { Minimatch } from 'minimatch';
import type { WatchOptions } from '@theia/filesystem/lib/common/filesystem-watcher-protocol';
import {
NsfwFileSystemWatcherService,
NsfwWatcher,
} from '@theia/filesystem/lib/node/nsfw-watcher/nsfw-filesystem-service';
// Dispose the watcher immediately when the last reference is removed. By default, Theia waits 10 sec.
// https://github.com/eclipse-theia/theia/issues/11639#issuecomment-1238980708
const NoDelay = 0;
export class NoDelayDisposalTimeoutNsfwFileSystemWatcherService extends NsfwFileSystemWatcherService {
protected override createWatcher(
clientId: number,
fsPath: string,
options: WatchOptions
): NsfwWatcher {
const watcherOptions = {
ignored: options.ignored.map(
(pattern) => new Minimatch(pattern, { dot: true })
),
};
return new NsfwWatcher(
clientId,
fsPath,
watcherOptions,
this.options,
this.maybeClient,
NoDelay
);
}
}

View File

@@ -1,62 +0,0 @@
{
"private": true,
"name": "browser-app",
"version": "2.0.0-rc9.3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@theia/core": "1.25.0",
"@theia/debug": "1.25.0",
"@theia/editor": "1.25.0",
"@theia/file-search": "1.25.0",
"@theia/filesystem": "1.25.0",
"@theia/keymaps": "1.25.0",
"@theia/messages": "1.25.0",
"@theia/monaco": "1.25.0",
"@theia/navigator": "1.25.0",
"@theia/plugin-ext": "1.25.0",
"@theia/plugin-ext-vscode": "1.25.0",
"@theia/preferences": "1.25.0",
"@theia/process": "1.25.0",
"@theia/terminal": "1.25.0",
"@theia/workspace": "1.25.0",
"arduino-ide-extension": "2.0.0-rc9.3"
},
"devDependencies": {
"@theia/cli": "1.25.0"
},
"scripts": {
"prepare": "theia build --mode development",
"start": "theia start --plugins=local-dir:../plugins",
"watch": "theia build --watch --mode development"
},
"theia": {
"frontend": {
"config": {
"applicationName": "Arduino IDE",
"defaultTheme": "arduino-theme",
"preferences": {
"files.autoSave": "afterDelay",
"editor.minimap.enabled": false,
"editor.tabSize": 2,
"editor.scrollBeyondLastLine": false,
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false
},
"breadcrumbs.enabled": false
}
}
},
"backend": {
"config": {
"configDirName": ".arduinoIDE"
}
},
"generator": {
"config": {
"preloadTemplate": "<div class='theia-preload' style='background-color: rgb(237, 241, 242);'></div>"
}
}
}
}

View File

@@ -1,20 +0,0 @@
/**
* This file can be edited to customize webpack configuration.
* To reset delete this file and rerun theia build again.
*/
// @ts-check
const config = require('./gen-webpack.config.js');
config.resolve.fallback['http'] = false;
config.resolve.fallback['fs'] = false;
/**
* Expose bundled modules on window.theia.moduleName namespace, e.g.
* window['theia']['@theia/core/lib/common/uri'].
* Such syntax can be used by external code, for instance, for testing.
config.module.rules.push({
test: /\.js$/,
loader: require.resolve('@theia/application-manager/lib/expose-loader')
}); */
module.exports = config;

29
docs/CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,29 @@
<!-- Source: https://github.com/arduino/tooling-project-assets/blob/main/documentation-templates/contributor-guide/general/CONTRIBUTING.md -->
# Contributor Guide
Thanks for your interest in contributing to this project!
There are several ways you can get involved:
| Type of contribution | Contribution method |
| ----------------------------------------- | -------------------------------------------------------------------------------- |
| - Support<br/>- Question<br/>- Discussion | Post on the [**Arduino Forum**][forum] |
| - Bug report<br/>- Feature request | Issue report (see the guide [**here**][issues]) |
| Testing | Beta testing, PR review (see the guide [**here**][beta-testing]) |
| Translation | [Transifex project][translate] |
| - Bug fix<br/>- Enhancement | Pull request (see the guide [**here**][prs]) |
| Monetary | - [Donate][donate]<br/>- [Sponsor][sponsor]<br/>- [Buy official products][store] |
[forum]: https://forum.arduino.cc
[issues]: contributor-guide/issues.md#issue-report-guide
[beta-testing]: contributor-guide/beta-testing.md#beta-testing-guide
[translate]: https://www.transifex.com/arduino-1/ide2/dashboard/
[prs]: contributor-guide/pull-requests.md#pull-request-guide
[donate]: https://www.arduino.cc/en/donate/
[sponsor]: https://github.com/sponsors/arduino
[store]: https://store.arduino.cc
## Resources
- [**Development Guide**](development.md#development-guide)

View File

@@ -1,7 +1,7 @@
# Remote Sketchbook
Arduino IDE provides a Remote Sketchbook feature that can be used to upload sketches to Arduino Cloud.
![](static/remote.png)
![](assets/remote.png)
@@ -13,7 +13,7 @@ A developer could use the content of this repo to create a customized version of
### 1. Changing remote connection parameters in the Preferences panel (be careful while editing the Preferences panel!)
Here a screenshot of the Preferences panel
![](static/preferences.png)
![](assets/preferences.png)
- The settings under _Arduino > Auth_ should be edited to match the OAuth2 configuration of your custom remote sketchbook storage
- The setting under _Arduino > Sketch Sync Endpoint_ should be edited to point to your custom remote sketchbook storage service
### 2. Implementing the Arduino Cloud Store APIs for your custom remote sketchbook storage

14
docs/advanced-usage.md Normal file
View File

@@ -0,0 +1,14 @@
# Advanced usage
## Advanced settings
The Arduino IDE's primary settings are accessible via the **File > Preferences** menu item. These provide all the configuration capability required by the average user to develop sketches.
Arduino IDE has some additional settings which may be of interest to advanced users who want to do things such as fine tune the behavior of the application or increase log output while investigating a problem.
These advanced settings can be accessed by the following procedure:
1. Press the <kbd>**Ctrl**</kbd>+<kbd>**Shift**</kbd>+<kbd>**P**</kbd> keyboard shortcut (<kbd>**Command**</kbd>+<kbd>**Shift**</kbd>+<kbd>**P**</kbd> for macOS users) to open the "**Command Palette**".
1. Select the "**Preferences: Open Settings (UI)**" command from the menu.
This will open a "**Preferences**" view in the IDE. Once you are finished adjusting settings, it can be closed by clicking the **X** icon on the "**Preferences**" tab.

View File

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,108 @@
<!-- Source: https://github.com/arduino/tooling-project-assets/blob/main/documentation-templates/contributor-guide/application/contributor-guide/beta-testing.md -->
# Beta Testing Guide
Beta testing of development versions is a valuable contribution to the project. You can help to ensure the quality of the production release that will be distributed to the user community.
Builds of the project are automatically created after every relevant change to the project in order to make it easy for anyone to participate in the testing effort.
---
❗ Make sure to always download the newest available tester build in order to ensure effective results from your beta testing efforts.
---
Beta testing is done during both the proposal (pull request) and pre-release (nightly build) phases of development:
## Testing Pull Requests
Tester builds are automatically created for every [pull request](https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) (PR) that proposes a relevant change.
The builds are updated if the author pushes changes to the PR.
### Installation
The tester build for a PR can be downloaded by following these instructions:
1. Sign in to your [**GitHub**](https://github.com/) account.<br />
(GitHub only allows downloads of the tester builds when you are signed in.)
1. Open the PR you are interested in.<br />
They are listed here:<br />
https://github.com/arduino/arduino-ide/pulls
1. Click the "**Checks**" tab at the top of the PR's page.
1. From the list on the left side of the page, click on "**Arduino IDE**".
1. Scroll down to the "**Artifacts**" section of the page that opens.
1. Click the download link for your operating system.<br />
**ⓘ** For example, if you are using Windows, click the "**Windows_X86-64_zip**" link.
1. Wait for the download to finish.
1. Extract or install the downloaded file as usual.
![checks tab](assets/checks-tab.png)
![tester build link](assets/tester-build-link.png)
![tester build artifacts](assets/tester-build-artifacts.png)
#### Notes for macOS
Beginning in macOS 10.14.5, the software [must be notarized to run](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution).
For security reasons, signing and notarization are disabled when creating tester builds for pull requests from forks of this repository. This means that macOS will block you from running the tester builds for those PRs.
Due to this limitation, Mac users have two options for testing PRs from forks:
##### The Safe Approach
Build the version of the Arduino IDE you want to test from source instead of using the automatically created tester build.
[Instructions for building the project](../development.md#build-from-source)
##### The Risky Approach
---
⚠ Please note that this approach is risky as you are lowering the security on your system, therefore we strongly discourage you from following it.
---
1. Start the tester build.<br />
A warning will appear:
> "Arduino IDE" cannot be opened because the developer cannot be verified.
1. Follow the instructions from the "**If you want to open an app that hasn't been notarized or is from an unidentified developer**" section of this page to bypass the security restriction:<br />
[https://support.apple.com/en-us/HT202491](https://support.apple.com/en-us/HT202491#:~:text=If%20you%20want%20to%20open%20an%20app%20that%20hasn%E2%80%99t%20been%20notarized%20or%20is%20from%20an%20unidentified%20developer)
### Feedback
Feedback after beta testing a pull request is always valuable, regardless of which categories your findings fall under:
- working as expected
- problems encountered
- areas for improvement
Please submit feedback related to the changes made in the pull request as a PR review:
https://docs.github.com/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews
---
If you discover problems or areas for improvement that are unrelated to the changes made by the PR (i.e., they also occur when using the [nightly build](#testing-nightly-build)), please submit that feedback as an issue report instead of a review.
[More information on issue reports](issues.md#issue-report-guide)
## Testing Nightly Build
Builds of the project's production branch are produced daily. This build represents the current pre-release state of the project, which is planned for distribution in the next release.
### Installation
1. Open Arduino's "**Software**" page:<br />
https://www.arduino.cc/en/software#nightly-builds
1. Select the appropriate download link from the "**Nightly Builds**" section of the page.
1. Wait for the download to finish.
1. Extract or install the downloaded file as usual.
### Feedback
If you discover any problems or areas for improvement please submit an issue report.
[More information on issue reports](issues.md#issue-report-guide)

View File

@@ -0,0 +1,33 @@
<!-- Source: https://github.com/arduino/tooling-project-assets/blob/main/documentation-templates/contributor-guide/general/contributor-guide/issues.md -->
# Issue Report Guide
---
❗ Do you need help or have a question about using this project? Support requests should be made to the [Arduino Forum](https://forum.arduino.cc).
---
High quality bug reports and feature requests are valuable contributions to this project. These can be made by submitting an issue report to the project's GitHub repository:
https://github.com/arduino/arduino-ide/issues/new/choose
## Before Reporting an Issue
- Give the latest development version a test drive to see if your issue was already resolved:<br />
https://www.arduino.cc/en/software#nightly-builds
- Search [existing pull requests and issues](https://github.com/arduino/arduino-ide/issues?q=) to see if it was already reported.<br />
If you have additional information to provide about an existing issue, please comment there instead of creating a duplicate. You can use [GitHub's "Reactions" feature](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) if you only want to express support 👍.
## Qualities of an Excellent Report
- Concise and descriptive issue title.<br />
Vague titles make it difficult to decipher the purpose of the issue when looking through the list of reports, which might result in your issue not being given proper attention.
- Describe the issue and what behavior you were expecting.<br />
Include the full and exact text of any relevant error or warning messages you might have encountered.
- Provide a full set of steps necessary to reproduce the issue.<br />
Demonstration code or commands should be complete and simplified to the minimum necessary to reproduce the issue.
- Be responsive.<br />
We may need you to provide additional information in order to investigate and resolve the issue.<br />
Make sure your GitHub account is configured so that you will receive notifications of responses to your issue report.
- If you find a solution to your problem, please comment on your issue report with an explanation of how you were able to fix it, then close the issue.

View File

@@ -0,0 +1,199 @@
<!-- Source: https://github.com/arduino/tooling-project-assets/blob/main/documentation-templates/contributor-guide/general/contributor-guide/pull-requests.md -->
# Pull Request Guide
A [**pull request**](https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) (PR) is the mechanism used to propose changes to the content of this project's repository.
If you are looking for ideas of what to work on, check [the list of open issue reports](https://github.com/arduino/arduino-ide/issues). Pull requests addressing any of those bug reports and feature requests are welcome.
## Contribution Workflow
Each contribution travels through a formal process which allows it to be efficiently incorporated into the project.
### 1. Plan
#### Research
Start by searching the repository for existing pull requests and issues related to your planned contribution so you can see any related conversations and proposals and avoid duplicate effort:
https://github.com/arduino/arduino-ide/issues?q=
#### Discussion
It can sometimes be useful to get feedback from others during the planning process. There are a couple good options for discussing planned development work:
- Talk with the user community on the [Arduino Forum](https://forum.arduino.cc/).
- Talk with Arduino developers on the [Arduino Developers Mailing List](https://groups.google.com/a/arduino.cc/g/developers).
### 2. Fork
Forking a GitHub repository creates a copy of it under your account. You will stage contributions in your fork of this project.
[More information about forking repositories](https://docs.github.com/get-started/quickstart/fork-a-repo)
#### Enabling CI in Your Fork
The repository is configured to run automated [continuous integration](https://wikipedia.org/wiki/Continuous_integration) (CI) checks and tests. It's a good idea to enable CI in your fork so you can make sure your work will pass the checks before you submit a pull request:
1. Open the homepage of your fork in the browser.
1. Click the "**Actions**" tab.
1. Click the <kbd>**I understand my workflows, go ahead and enable them**</kbd> button.
1. Some of the workflows will now need to be activated individually. Perform the following steps for each of the useful workflows listed on the left side of the page that have a "**!**" icon:
1. Click on the workflow name.
1. Click the <kbd>**Enable workflow**</kbd> button.
### 3. Clone
Cloning a repository creates a copy of it on your computer.
It is possible to make simple changes to your repository using the GitHub web interface without cloning the repository. However, the GitHub web interface is quite limiting so you will likely find the need to work with a clone (using **Git** directly or your choice of [Git client software](https://git-scm.com/downloads/guis)) for any significant development work.
[More information about cloning repositories](https://git-scm.com/docs/git-clone)
### 4. Branch
Create a branch in your fork to contain the changes for your contribution. You must make a separate branch in your fork for each pull request you submit.
[More information about branches](https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches)
### 5. Make a change
Some things to keep in mind:
- Make sure your change complies with the project's established style conventions.
- Remember to also update the documentation content in the repository if required by your changes.
- If the project contains a test suite, update or add tests according to your change as appropriate.
See [the development guide](../development.md#development-guide) for more information.
### 6. Test
Test your change carefully to make sure it works correctly and did not break other components of the project.
As a supplement for general testing, the project is set up with automated checks and tests to facilitate development.
See [the development guide](../development.md#development-guide) for instructions.
### 7. Commit
Once the work on your change is complete, add it to the revision history of the Git repository by making a commit.
Make sure to follow the [Commit Guidelines](#commit-guidelines).
[More information about commits](https://git-scm.com/docs/git-commit)
### 8. Push
If you're working from a [clone](#3-clone), you will need to push your commit to your fork on GitHub.
[More information about pushing commits](https://git-scm.com/docs/git-push)
#### Checking CI Results
If you have [enabled CI in your repository](#enabling-ci-in-your-fork), GitHub will run the relevant checks automatically every time you push a commit to your fork.
You can see the results of these checks by doing either of the following:
- Clicking the status icon (✔️ or ❌) shown to the right of a commit.
- Opening the repository's "**Actions**" tab.
### 9. Pull request
A pull request (PR) is a proposal to make a change in a repository. The repository maintainer is able to accept the changes you propose in a pull request by simply clicking a button.
[More information about pull requests](https://docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests)
#### Scope
Each pull request should address a single bug fix or enhancement. If you have multiple unrelated fixes or enhancements to contribute, submit them as separate pull requests.
#### Description
Pull request title and description should follow [the same guidelines as commit messages](#commit-message).
If your pull request fixes an issue in the issue tracker, use [a closing keyword](https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) in the body to indicate this.
In some cases, it might make sense to request feedback on a proposal before it is ready to be merged. You can indicate this by starting the pull request title with **[WIP]** (work in progress). Once the pull request is ready to be merged, edit the title and remove the "[WIP]".
#### Cross-repository Contributions
Some proposals may require changes to multiple repositories. Pull requests should be submitted in parallel to each repository.
Clearly note any dependencies on other PRs in the description so that these can be evaluated by the reviewer and the merges coordinated.
---
Please check whether any changes are required to the related documentation content hosted in the separate dedicated repositories:
- [**arduino/docs-content**](https://github.com/arduino/docs-content)
- [**arduino/help-center-content**](https://github.com/arduino/help-center-content)
### 10. Resolve CI failures
Relevant checks will run automatically once you have submitted the pull request. Once these checks are finished, you can see a summary of the results near the bottom of the pull request page:
![checks](assets/checks.png)
Failed checks will be indicated with an ❌. If any checks failed, please fix whatever caused it to fail. Click the "**Details**" link to the right of the check name to open the logs, which provide details about the failure.
---
**ⓘ** In some rare cases, a CI failure may be unrelated to the changes made in your pull request. So if the information in the logs doesn't seem relevant, please comment on the pull request to ask a maintainer to take a look.
---
When you push to the branch of your fork the pull request was submitted from, the commit is automatically added to the pull request. Don't create a new pull request to fix problems; update the existing pull request.
### 11. Resolve changes requested from reviews
Interested parties may review your pull request and suggest improvements.
To act on general review suggestions, you can add commits to the branch you submitted the pull request from, which will automatically be added to the pull request. Don't create a new pull request to act on review suggestions; update the existing pull request.
Reviewers may suggest specific changes, which can be applied by [clicking the <kbd>**Commit suggestion**</kbd> button](https://docs.github.com/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request#applying-suggested-changes).
[More information about pull request reviews](https://docs.github.com/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews)
### 12. Merge
One of the repository maintainers can now choose to accept your proposed change. Once the pull request is [merged](https://docs.github.com/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request), you can delete the branch you created in your fork for the pull request and delete the fork as well if you like.
Thanks so much for your contribution!
---
It is possible that the maintainers may decide a pull request doesn't align with Arduino's goals for the project and close it rather than merging. A record of the proposed changes will always be available on GitHub for future reference. If you think your modifications will be of use to others, you are welcome to maintain your own fork of the repository.
---
## Commit Guidelines
The commit history of a repository is an important resource for developers. Repositories may accumulate thousands of commits over the course of decades. Each individual commit contributes either to the commit history being pleasant and efficient to work with, or to it being a confusing mess. For this reason, it's essential for contributors to create clean, high quality commits.
### Scope
Commits must be "atomic". This means that the commit completely accomplishes a single task. Each commit should result in fully functional code. Multiple tasks should not be combined in a single commit, but a single task should not be split over multiple commits (e.g., one commit per file modified is not a good practice).
[More information about atomic commits](https://www.freshconsulting.com/insights/blog/atomic-commits/)
### Commit Message
The commit message documents what the change was and why it was done. A little effort now writing a good commit message can save future developers from wasted time and frustration trying to understand the purpose of a poorly documented commit.
#### Commit Message Title
- Use the [imperative mood](https://cbea.ms/git-commit/#imperative) in the title.<br />
For example:
> Use LED_BUILTIN macro in LED pin definition
- Capitalize the title.
- Do not end the title with punctuation.
- Do not use GitHub's default commit titles (e.g., "Update examples/Foo/Foo.ino").
#### Commit Message Body
- Separate title from the body with a blank line. If you're committing via GitHub or [GitHub Desktop](https://desktop.github.com/) this will be done automatically.
- Wrap body at 120 characters.
- Completely explain the purpose of the commit.<br />
Include a rationale for the change, any caveats, side-effects, etc.
[More information on commit messages](https://cbea.ms/git-commit/)

116
docs/development.md Normal file
View File

@@ -0,0 +1,116 @@
# Development Guide
This page includes technical documentation for developers who want to build the IDE locally and contribute to the project.
## Architecture overview
The IDE consists of three major parts:
- the _Electron main_ process,
- the _backend_, and
- the _frontend_.
The _Electron main_ process is responsible for:
- creating the application,
- managing the application lifecycle via listeners, and
- creating and managing the web pages for the app.
In Electron, the process that runs the main entry JavaScript file is called the main process. The _Electron main_ process can display a GUI by creating web pages. An Electron app always has exactly one main process.
By default, whenever the _Electron main_ process creates a web page, it will instantiate a new `BrowserWindow` instance. Since Electron uses Chromium for displaying web pages, Chromium's multi-process architecture is also used. Each web page in Electron runs in its own process, which is called the renderer process. Each `BrowserWindow` instance runs the web page in its own renderer process. When a `BrowserWindow` instance is destroyed, the corresponding renderer process is also terminated. The main process manages all web pages and their corresponding renderer processes. Each renderer process is isolated and only cares about the web page running in it.<sup>[[1]]</sup>
In normal browsers, web pages usually run in a sandboxed environment, and accessing native resources are disallowed. However, Electron has the power to use Node.js APIs in the web pages allowing lower-level OS interactions. Due to security reasons, accessing native resources is an undesired behavior in the IDE. So by convention, we do not use Node.js APIs. (Note: the Node.js integration is [not yet disabled](https://github.com/eclipse-theia/theia/issues/2018) although it is not used). In the IDE, only the _backend_ allows OS interaction.
The _backend_ process is responsible for:
- providing access to the filesystem,
- communicating with the [Arduino CLI](https://github.com/arduino/arduino-cli) via gRPC,
- running your terminal,
- exposing additional RESTful APIs,
- performing the Git commands in the local repositories,
- hosting and running any VS Code extensions, or
- executing VS Code tasks<sup>[[2]]</sup>.
The _Electron main_ process spawns the _backend_ process. There is always exactly one _backend_ process. However, due to performance considerations, the _backend_ spawns several sub-processes for the filesystem watching, Git repository discovery, etc. The communication between the _backend_ process and its sub-processes is established via IPC. Besides spawning sub-processes, the _backend_ will start an HTTP server on a random available port, and serves the web application as static content. When the sub-processes are up and running, and the HTTP server is also listening, the _backend_ process sends the HTTP server port to the _Electron main_ process via IPC. The _Electron main_ process will load the _backend_'s endpoint in the `BrowserWindow`.
The _frontend_ is running as an Electron renderer process and can invoke services implemented on the _backend_. The communication between the _backend_ and the _frontend_ is done via JSON-RPC over a websocket connection. This means, the services running in the _frontend_ are all proxies, and will ask the corresponding service implementation on the _backend_.
[1]: https://www.electronjs.org/docs/tutorial/application-architecture#differences-between-main-process-and-renderer-process
[2]: https://code.visualstudio.com/Docs/editor/tasks
### Additional Components
This repository contains the main code, but two more repositories are included during the build process:
- [vscode-arduino-tools](https://github.com/arduino/vscode-arduino-tools): provides support for the language server and the debugger
- [arduino-language-server](https://github.com/arduino/arduino-language-server): provides the language server that parses Arduino code
## Build from source
---
**ⓘ** If you only want to test an existing version of the project, automatically generated builds are available for download without building from source. See the instructions in the [**beta testing guide**](contributor-guide/beta-testing.md#beta-testing-guide).
---
If youre familiar with TypeScript, the [Theia IDE](https://theia-ide.org/), and if you want to contribute to the
project, you should be able to build the Arduino IDE locally.
Please refer to the [Theia IDE prerequisites](https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisites) documentation for the setup instructions.
> **Note**: Node.js 14 must be used instead of the version 12 recommended at the link above.
Once you have all the tools installed, you can build the editor following these steps
1. Install the dependencies and build
```sh
yarn
```
2. Rebuild the dependencies
```sh
yarn rebuild:browser
```
3. Rebuild the electron dependencies
```sh
yarn rebuild:electron
```
4. Start the application
```sh
yarn start
```
### Notes for Windows contributors
Windows requires the Microsoft Visual C++ (MSVC) compiler toolset to be installed on your development machine.
In case it's not already present, it can be downloaded from the "**Tools for Visual Studio 20XX**" section of the Visual Studio [downloads page](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022) via the "**Build Tools for Visual Studio 20XX**" (e.g., "**Build Tools for Visual Studio 2022**") download link.
Select "**Desktop development with C++**" from the "**Workloads**" tab during the installation procedure.
### CI
This project is built on [GitHub Actions](https://github.com/arduino/arduino-ide/actions).
- _Snapshot_ builds run when changes are pushed to the `main` branch, or when a PR is created against the `main` branch. For the sake of the review and verification process, the build artifacts for each operating system can be downloaded from the GitHub Actions page.
- _Nightly_ builds run every day at 03:00 GMT from the `main` branch.
- _Release_ builds run when a new tag is pushed to the remote. The tag must follow the [semver](https://semver.org/). For instance, `1.2.3` is a correct tag, but `v2.3.4` won't work. Steps to trigger a new release build:
- Create a local tag:
```sh
git tag -a 1.2.3 -m "Creating a new tag for the `1.2.3` release."
```
- Push it to the remote:
```sh
git push origin 1.2.3
```
## FAQ
* *Can I manually change the version of the [`arduino-cli`](https://github.com/arduino/arduino-cli/) used by the IDE?*
Yes. It is possible but not recommended. The CLI exposes a set of functionality via [gRPC](https://github.com/arduino/arduino-cli/tree/master/rpc) and the IDE uses this API to communicate with the CLI. Before we build a new version of IDE, we pin a specific version of CLI and use the corresponding `proto` files to generate TypeScript modules for gRPC. This means, a particular version of IDE is compliant only with the pinned version of CLI. Mismatching IDE and CLI versions might not be able to communicate with each other. This could cause unpredictable IDE behavior.
* *I have understood that not all versions of the CLI are compatible with my version of IDE but how can I manually update the `arduino-cli` inside the IDE?*
[Get](https://arduino.github.io/arduino-cli/installation) the desired version of `arduino-cli` for your platform and manually replace the one inside the IDE. The CLI can be found inside the IDE at:
- Windows: `C:\path\to\Arduino IDE\resources\app\node_modules\arduino-ide-extension\build\arduino-cli.exe`,
- macOS: `/path/to/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-cli`, and
- Linux: `/path/to/Arduino IDE/resources/app/node_modules/arduino-ide-extension/build/arduino-cli`.

View File

@@ -41,7 +41,7 @@ Building the Pro IDE on Linux `armv7l` (aka `armhf`) and `aarch64` (aka `arm64`)
- `libx11-dev`, and
- `libxkbfile-dev`
4. [Build it](../../BUILDING.md#build-from-source) from the source:
4. [Build it](../development.md#build-from-source) from the source:
```
git clone https://github.com/arduino/arduino-ide.git \
&& cd arduino-ide \

View File

@@ -0,0 +1,99 @@
# Release Procedure
## 🗺️ Merge localization sync PR
A pull request titled "**Update translation files**" is submitted periodically by the "**github-actions**" bot to pull in the localization data from [**Transifex**](https://www.transifex.com/arduino-1/ide2/dashboard/).
If there is an open PR, this must be merged before making the release.
It will be shown in these search results:
https://github.com/arduino/arduino-ide/pulls/app%2Fgithub-actions
## ⚙ Create the release on GitHub
First of all, you need to **set the new version in all the `package.json` files** across the app (`./package.json`, `./arduino-ide-extension/package.json`, and `./electron-app/package.json`), create a PR, and merge it on the `main` branch.
To do so, you can make use of the `update:version` script.
For example, if you want to release the version `<YOUR_VERSION>`, you should run the following commands:
```text
git checkout main
git pull
git checkout -b version-<YOUR_VERSION>
yarn update:version <YOUR_VERSION>
git commit -am <YOUR_VERSION>
git push origin version-<YOUR_VERSION>
```
replacing `<YOUR_VERSION>` with the version you want to release. Then create a PR and merge it.
Then, you need to **create and push the new tag** and wait for the release to appear on [the "**Releases**" page](https://github.com/arduino/arduino-ide/releases).
⚠ Doing this will create a new release and users who already have the IDE installed will be notified from the automatic updater that a new version is available. Do not push the tag if you don't want that.
```text
git checkout main
git pull
git tag -a <YOUR_VERSION> -m "<YOUR_VERSION>"
git push origin <YOUR_VERSION>
```
Pushing a tag will trigger a **GitHub Actions** workflow on the `main` branch. Check the "**Arduino IDE**" workflow and see that everything goes right. If the workflow succeeds, a new release will be created automatically and you should see it on the ["**Releases**"](https://github.com/arduino/arduino-ide/releases) page.
## 📄 Create the changelog
**Create GitHub issues for the known issues** that we haven't solved in the current release:
https://github.com/arduino/arduino-ide/issues
From the ["**Releases**"](https://github.com/arduino/arduino-ide/releases) page, edit the release notes following the **Keep A Changelog** scheme:
https://keepachangelog.com/en/1.0.0/#how
Add a list of mentions of GitHub users who contributed to the release in any of the following ways (ask @per1234):
- Submitted a PR that was merged
- Made a valuable review of a PR
- Submitted an issue that was resolved
- Provided valuable assistance with the investigation of an issue that was resolved
Add a "**Known Issues**" section at the bottom of the changelog.
## ✎ Update the "**Software**" Page
Open a PR on the [bcmi-labs/wiki-content](https://github.com/bcmi-labs/wiki-content) repository to update the links and texts.
If you don't have access to the repo, ask in the `#team_wedo` **Slack** channel.
**❗ Make sure all the links to the new IDE build are working.**<br />
If they aren't, there has probably been some issue with [the "**Arduino IDE**" workflow run](https://github.com/arduino/arduino-ide/actions/workflows/build.yml) triggered when pushing the tag during the "**Create the release on GitHub**" step of the release procedure.
Ask for a review of the PR and merge it.
Follow the ["**Production (subset of https://arduino.cc)**" instructions](https://github.com/bcmi-labs/wiki-content#production-subset-of-httpsarduinocc) in the `bcmi-labs/wiki-content` repository readme to deploy the updated "**Software**" page content.
When the deploy workflow is done, check if links on the "**Software**" page are working:
https://www.arduino.cc/en/software#future-version-of-the-arduino-ide
## 😎 Brag about it
- Ask in the `#product_releases` **Slack** channel to write a post for the social media and, if needed, a blog post.
- Post a message on the forum (ask @per1234).<br />
Example: https://forum.arduino.cc/t/arduino-ide-2-0-0-rc9-3-available-for-download/1028858/4
- Write a message in the `#general` **Slack** channel:
> Hey **Arduino**s! Updates from the **Tooling Team** :hammer_and_wrench:
>
> Arduino IDE 2.0.0 Beta 12 is out! :doge: You can download it from the [Download Page](https://www.arduino.cc/en/software#experimental-software)
> The highlights of this release are:
>
> - auto-installation of arduino:avr at first startup
> - improvement of Serial Monitor performances
> - Arduino CLI upgrade to 0.19.1
> - Theia upgrade to 1.18.0
> - some bugfixing
>
> To see the details, you can take a look at the [Changelog](https://github.com/arduino/arduino-ide/releases/tag/2.0.0-beta.12)
> If you want to post about it on social media and you need more details feel free to ask us on #team_tooling! :wink:

View File

@@ -1,7 +1,7 @@
{
"private": true,
"name": "electron-app",
"version": "2.0.0-rc9.3",
"version": "2.0.0",
"license": "AGPL-3.0-or-later",
"main": "src-gen/frontend/electron-main.js",
"dependencies": {
@@ -21,7 +21,7 @@
"@theia/process": "1.25.0",
"@theia/terminal": "1.25.0",
"@theia/workspace": "1.25.0",
"arduino-ide-extension": "2.0.0-rc9.3"
"arduino-ide-extension": "2.0.0"
},
"devDependencies": {
"@theia/cli": "1.25.0",

View File

@@ -80,9 +80,9 @@ function getVersion() {
}
if (!isRelease) {
if (isNightly) {
version = `${version}.nightly-${timestamp()}`;
version = `${version}-nightly-${timestamp()}`;
} else {
version = `${version}.snapshot-${currentCommitish()}`;
version = `${version}-snapshot-${currentCommitish()}`;
}
if (!semver.valid(version)) {
throw new Error(`Invalid patched version: '${version}'.`);

View File

@@ -119,14 +119,14 @@
}
verifyVersions(allDependencies);
//-------------------------------------------------------------+
// Save some time: no need to build the `browser-app` example. |
//-------------------------------------------------------------+
//---------------------------------------------------------------------------------------------------+
// Save some time: no need to build the projects that are not needed in final app. Currently unused. |
//---------------------------------------------------------------------------------------------------+
//@ts-ignore
let pkg = require('../working-copy/package.json');
const workspaces = pkg.workspaces;
// We cannot remove the `electron-app`. Otherwise, there is not way to collect the unused dependencies.
const dependenciesToRemove = ['browser-app'];
const dependenciesToRemove = [];
for (const dependencyToRemove of dependenciesToRemove) {
const index = workspaces.indexOf(dependencyToRemove);
if (index !== -1) {

View File

@@ -336,7 +336,7 @@
"serial": {
"autoscroll": "Autoscroll",
"carriageReturn": "Carriage Return",
"message": "Message ({0} + Enter to send message to '{1}' on '{2}')",
"message": "Message (Enter to send message to '{0}' on '{1}')",
"newLine": "New Line",
"newLineCarriageReturn": "Both NL & CR",
"noLineEndings": "No Line Ending",

View File

@@ -115,22 +115,22 @@
},
"common": {
"all": "הכל",
"contributed": "Contributed",
"contributed": "נתרם",
"installManually": "התקן ידנית",
"later": "אחר כך",
"noBoardSelected": "לא נבחר לוח",
"notConnected": "[לא מחובר]",
"offlineIndicator": "You appear to be offline. Without an Internet connection, the Arduino CLI might not be able to download the required resources and could cause malfunction. Please connect to the Internet and restart the application.",
"oldFormat": "ה'{0}' עדיין משתמש בפורמט הישן `.pde`. האם תרצה להחליף לסיומת החדשה `.ino` ? ",
"partner": "Partner",
"partner": "שותף",
"processing": "מעבד",
"recommended": "Recommended",
"recommended": "מומלץ",
"retired": "Retired",
"selectedOn": "ב {0}",
"serialMonitor": "מוניטור סיריאלי",
"type": "Type",
"type": "סוג",
"unknown": "לא ידוע",
"updateable": "Updatable"
"updateable": "ניתן לעדכון"
},
"compile": {
"error": "שגיאת קומפילציה: {0}"
@@ -216,7 +216,7 @@
"visit": "בקר ב Arduino.cc"
},
"ide-updater": {
"checkForUpdates": "Check for Arduino IDE Updates",
"checkForUpdates": "בדיקת עדכונים לArduino IDE",
"closeAndInstallButton": "סגור והתקן",
"closeToInstallNotice": "סגור את התוכנה והתקן את העדכון על המכונה שלך.",
"downloadButton": "הורד",
@@ -310,13 +310,13 @@
"files.inside.sketches": "הראה קבצים בתוך הסקיצה",
"ide.updateBaseUrl": "The base URL where to download updates from. Defaults to 'https://downloads.arduino.cc/arduino-ide'",
"ide.updateChannel": "Release channel to get updated from. 'stable' is the stable release, 'nightly' is the latest development build.",
"interfaceScale": "Interface scale",
"interfaceScale": "מידת ממשק",
"invalid.editorFontSize": "גודל גופן לא חוקי. חייב להיות מספר חיובי.",
"invalid.sketchbook.location": "Invalid sketchbook location: {0}",
"invalid.sketchbook.location": "מיקום סקיצה לא חוקי: {0}",
"invalid.theme": "ערכת נושא לא חוקית.",
"language.log": "True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default.",
"language.realTimeDiagnostics": "If true, the language server provides real-time diagnostics when typing in the editor. It's false by default.",
"manualProxy": "Manual proxy configuration",
"manualProxy": "הגדרת פרוקסי ידנית",
"network": "רשת",
"newSketchbookLocation": "Select new sketchbook location",
"noProxy": "ללא פרוקסי",

View File

@@ -126,7 +126,7 @@
"processing": "Processing",
"recommended": "Önerilen",
"retired": "Emekli",
"selectedOn": "{0}'da",
"selectedOn": "- {0}",
"serialMonitor": "Seri Port Ekranı",
"type": "Tür",
"unknown": "Bilinmeyen",

View File

@@ -6,7 +6,7 @@
},
"board": {
"board": "开发板 {0}",
"boardConfigDialogTitle": "Select Other Board and Port",
"boardConfigDialogTitle": "选择其他开发板和端口",
"boardInfo": "开发板信息",
"configDialog1": "如果要上传项目,请选择开发板和端口。",
"configDialog2": "如果你只选择了开发板,你可以编译项目,但不能上传项目。",
@@ -16,7 +16,7 @@
"inSketchbook": "(在项目文件夹中)",
"installNow": "必须为当前选定的 {2} 开发板板安装 “{0}{1}” 内核。你想现在安装吗?",
"noFQBN": "FQBN 不可用于所选开发板 “{0}”。你是否安装了相应的内核?",
"noPortsDiscovered": "No ports discovered",
"noPortsDiscovered": "未发现端口",
"noPortsSelected": "没有为开发板选择端口:‘{0}’。",
"noneSelected": "未选择任何开发板。",
"openBoardsConfig": "选择其他开发板和接口......",
@@ -26,7 +26,7 @@
"portLabel": "端口:{0}",
"programmer": "编程器",
"reselectLater": "稍后重新选择",
"searchBoard": "Search board",
"searchBoard": "搜索开发坂",
"selectBoard": "选择开发板",
"selectBoardForInfo": "请选择一个开发板以获取开发板信息。",
"selectPortForInfo": "请选择一个端口以获取开发板信息。",
@@ -36,7 +36,7 @@
},
"boardsManager": "开发板管理器",
"boardsType": {
"arduinoCertified": "Arduino Certified"
"arduinoCertified": "Arduino 认证"
},
"bootloader": {
"burnBootloader": "烧录引导程序",
@@ -54,7 +54,7 @@
"enterURL": "输入地址",
"noSupportedBoardConnected": "未连接受支持的开发板",
"openContext": "打开上下文",
"remove": "除",
"remove": "除",
"selectBoard": "选择开发板...",
"selectCertificateToUpload": "1.选择要上传的证书",
"selectDestinationBoardToUpload": "2.选择开发板并上传证书",
@@ -64,13 +64,13 @@
"uploadingCertificates": "上传证书。"
},
"checkForUpdates": {
"checkForUpdates": "Check for Arduino Updates",
"installAll": "Install All",
"noUpdates": "There are no recent updates available.",
"promptUpdateBoards": "Updates are available for some of your boards.",
"promptUpdateLibraries": "Updates are available for some of your libraries.",
"updatingBoards": "Updating boards...",
"updatingLibraries": "Updating libraries..."
"checkForUpdates": "检查 Arduino 更新",
"installAll": "全部安装",
"noUpdates": "没有可用的更新。",
"promptUpdateBoards": "您的某些开发板有可用更新。",
"promptUpdateLibraries": "您的某些库有可用更新。",
"updatingBoards": "更新开发板中...",
"updatingLibraries": "更新库中..."
},
"cli-error-parser": {
"keyboardError": "没有找到 Keyboard请检查您的项目是否包含 #include<Keyboard.h>",
@@ -114,29 +114,29 @@
"visitArduinoCloud": "访问 Arduino Cloud 以创建云项目。"
},
"common": {
"all": "All",
"contributed": "Contributed",
"all": "全部",
"contributed": "已贡献",
"installManually": "手动安装",
"later": "之后",
"noBoardSelected": "没有选择开发板",
"notConnected": "[没有连接]",
"offlineIndicator": "你似乎处于离线状态。如果没有网络连接Arduino CLI 可能无法下载所需的资源,并可能导致故障。请连接网络并重新启动程序。",
"oldFormat": "{0} 仍然使用旧的 .pde 格式。是否要切换到新的 .ino 扩展?",
"partner": "Partner",
"partner": "合作伙伴",
"processing": "正在处理中",
"recommended": "Recommended",
"recommended": "推荐",
"retired": "Retired",
"selectedOn": "on {0}",
"serialMonitor": "串口监视器",
"type": "Type",
"type": "类型",
"unknown": "未知",
"updateable": "Updatable"
"updateable": "可更新"
},
"compile": {
"error": "编译错误:{0}"
},
"component": {
"boardsIncluded": "Boards included in this package:",
"boardsIncluded": "包含在此包中的开发板:",
"by": "by",
"filterSearch": "筛选搜索结果......",
"install": "安装",
@@ -152,7 +152,7 @@
},
"coreContribution": {
"copyError": "复制错误信息",
"noBoardSelected": "No board selected. Please select your Arduino board from the Tools > Board menu."
"noBoardSelected": "未选择开发板。请从工具 > 板菜单中选择您的 Arduino 开发板。"
},
"daemon": {
"restart": "重启守护进程",
@@ -178,7 +178,7 @@
"increaseIndent": "增加缩进",
"nextError": "下一个错误",
"previousError": "上一个错误",
"revealError": "Reveal Error"
"revealError": "显示错误"
},
"electron": {
"couldNotSave": "无法保存项目。请将未保存的工作复制到你喜爱的文本编辑器中,然后重新启动 IDE。",
@@ -216,7 +216,7 @@
"visit": "访问 Arduino.cc"
},
"ide-updater": {
"checkForUpdates": "Check for Arduino IDE Updates",
"checkForUpdates": "检查 Arduino IDE 更新",
"closeAndInstallButton": "关闭并安装",
"closeToInstallNotice": "关闭软件并安装更新。",
"downloadButton": "下载",
@@ -255,22 +255,22 @@
"zipLibrary": "库"
},
"librarySearchProperty": {
"topic": "Topic"
"topic": "话题"
},
"libraryTopic": {
"communication": "Communication",
"dataProcessing": "Data Processing",
"dataStorage": "Data Storage",
"deviceControl": "Device Control",
"display": "Display",
"other": "Other",
"sensors": "Sensors",
"signalInputOutput": "Signal Input/Output",
"timing": "Timing",
"uncategorized": "Uncategorized"
"dataProcessing": "数据处理",
"dataStorage": "数据存储",
"deviceControl": "设备控制",
"display": "显示",
"other": "其他",
"sensors": "传感器",
"signalInputOutput": "信号输入/输出",
"timing": "定时",
"uncategorized": "未分类"
},
"libraryType": {
"installed": "Installed"
"installed": "安装"
},
"menu": {
"advanced": "高级设置",
@@ -290,7 +290,7 @@
"automatic": " 自动调整",
"board.certificates": "可上传到开发板的证书列表",
"browse": "浏览",
"checkForUpdate": "Receive notifications of available updates for the IDE, boards, and libraries. Requires an IDE restart after change. It's true by default.",
"checkForUpdate": "接收 IDE、开发板和库的可用更新通知。更改后需要重启IDE。默认情况为开启。",
"choose": "选择",
"cli.daemonDebug": "启用对 Arduino CLI 的 gRPC 调用的调试记录。该设置需要重新启动 IDE 才能生效。默认不启用。",
"cloud.enabled": "True 则启用项目同步功能。默认为 True。",
@@ -386,7 +386,7 @@
},
"userFields": {
"cancel": "取消",
"enterField": "Enter {0}",
"enterField": "输入 {0}",
"upload": "上传"
}
},

View File

@@ -1,6 +1,6 @@
{
"name": "arduino-ide",
"version": "2.0.0-rc9.3",
"version": "2.0.0",
"description": "Arduino IDE",
"repository": "https://github.com/arduino/arduino-ide.git",
"author": "Arduino SA",
@@ -41,7 +41,7 @@
},
"scripts": {
"prepare": "lerna run prepare && yarn download:plugins",
"cleanup": "npx rimraf ./**/node_modules && rm -rf ./node_modules ./.browser_modules ./arduino-ide-extension/build ./arduino-ide-extension/downloads ./arduino-ide-extension/Examples ./arduino-ide-extension/lib ./browser-app/lib ./browser-app/src-gen ./browser-app/gen-webpack.config.js ./electron-app/lib ./electron-app/src-gen ./electron-app/gen-webpack.config.js",
"cleanup": "npx rimraf ./**/node_modules && rm -rf ./node_modules ./.browser_modules ./arduino-ide-extension/build ./arduino-ide-extension/downloads ./arduino-ide-extension/Examples ./arduino-ide-extension/lib ./electron-app/lib ./electron-app/src-gen ./electron-app/gen-webpack.config.js",
"rebuild:browser": "theia rebuild:browser",
"rebuild:electron": "theia rebuild:electron",
"start": "yarn --cwd ./electron-app start",
@@ -49,7 +49,7 @@
"test": "lerna run test",
"download:plugins": "theia download:plugins",
"update:version": "node ./scripts/update-version.js",
"i18n:generate": "theia nls-extract -e vscode -f \"+(arduino-ide-extension|browser-app|electron-app|plugins)/**/*.ts?(x)\" -o ./i18n/en.json",
"i18n:generate": "theia nls-extract -e vscode -f \"+(arduino-ide-extension|electron-app|plugins)/**/*.ts?(x)\" -o ./i18n/en.json",
"i18n:check": "yarn i18n:generate && git add -N ./i18n && git diff --exit-code ./i18n",
"i18n:push": "node ./scripts/i18n/transifex-push.js ./i18n/en.json",
"i18n:pull": "node ./scripts/i18n/transifex-pull.js ./i18n/",
@@ -69,8 +69,7 @@
},
"workspaces": [
"arduino-ide-extension",
"electron-app",
"browser-app"
"electron-app"
],
"theiaPluginsDir": "plugins",
"theiaPlugins": {

View File

@@ -27,7 +27,6 @@ console.log(`🛠️ Updating current version from '${currentVersion}' to '${tar
for (const toUpdate of [
path.join(repoRootPath, 'package.json'),
path.join(repoRootPath, 'electron-app', 'package.json'),
path.join(repoRootPath, 'browser-app', 'package.json'),
path.join(repoRootPath, 'arduino-ide-extension', 'package.json')
]) {
process.stdout.write(` Updating ${toUpdate}'...`);