Skip to content

Commit 25ab1d4

Browse files
authored
fix: expose selectedProgrammer + configOptions (#14)
Closes #13 Signed-off-by: dankeboy36 <[email protected]>
1 parent 0badc9d commit 25ab1d4

27 files changed

+1593
-305
lines changed

.github/workflows/build.yml

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
node-version: ${{ matrix.config.node }}
2929
- name: Install Dependencies
3030
run: npm ci
31+
- name: Check API Docs
32+
run: npm run doc && git diff --exit-code
3133
- name: Check Format
3234
run: npm run format && git diff --exit-code
3335
- name: Lint

.vscodeignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ src/**
88
.prettierignore
99
CHANGELOG.md
1010
webpack.config.js
11-
vsc-extension-quickstart.md
1211
**/tsconfig.json
1312
**/.eslintrc.json
1413
**/*.map
1514
**/*.ts
1615
release.config.js
1716
.nyc_output/**
17+
docs/**

README.md

+2-26
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,7 @@ This VS Code extension does not provide any functionality but a bridge between t
1010
1111
## API
1212

13-
### Variables
14-
15-
| Name | Description | Type | Note |
16-
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | :---------: |
17-
| `openedSketches` | All opened sketch folders in the window. | `SketchFolder[]` | ⚠️ `@alpha` |
18-
| `currentSketch` | The currently active sketch (folder) or `undefined`. The current sketch is the one that currently has focus or most recently had focus. The current sketch is in the opened sketches. | `SketchFolder \| undefined` | ⚠️ `@alpha` |
19-
| `config` | The currently configured Arduino CLI configuration. | `CliConfig` | ⚠️ `@alpha` |
20-
21-
### Events
22-
23-
| Name | Description | Type | Note |
24-
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | :---------: |
25-
| `onDidChangeCurrentSketch` | An event that is emitted when the current sketch has changed. _Note_ that the event also fires when the active editor changes to `undefined`. | `Event<{ currentSketch: SketchFolder \| undefined }>` | ⚠️ `@alpha` |
26-
| `onDidChangeSketchFolders` | An event that is emitted when sketch folders are added or removed. | `Event<SketchFoldersChangeEvent>` | ⚠️ `@alpha` |
27-
| `onDidChangeSketch` | An event that is emitted when the selected board, port, etc., has changed in the sketch folder. | `Event<ChangeEvent<SketchFolder>>` | ⚠️ `@alpha` |
28-
| `onDidChangeConfig` | An event that is emitter when the sketchbook (`directories.data`) or the data directory (`directories.data`) path has changed. | `Event<ChangeEvent<CliConfig>>` | ⚠️ `@alpha` |
29-
30-
### `SketchFolder`
31-
32-
| Name | Description | Type | Note |
33-
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | :---------: |
34-
| `sketchPath` | Absolute filesystem path of the sketch folder. | `string` | ⚠️ `@alpha` |
35-
| `compileSummary` | The summary of the latest sketch compilation. When the `sketchPath` is available but the sketch has not been verified (compiled), the compile summary can be `undefined`. | `CompileSummary` | ⚠️ `@alpha` |
36-
| `board` | The currently selected board associated with the sketch. If the `board` is undefined, no board is selected. If the `board` is a `BoardIdentifier`, it could be a recognized board on a detected port, but the board's platform could be absent. If platform is installed, the `board` is the lightweight representation of the board's detail. This information is [provided by the Arduino CLI](https://arduino.github.io/arduino-cli/latest/rpc/commands/#cc.arduino.cli.commands.v1.BoardDetailsResponse) for the currently selected board in the sketch folder. | `string` | ⚠️ `@alpha` |
37-
| `port` | The currently selected port in the sketch folder. | [`Port`](https://arduino.github.io/arduino-cli/latest/rpc/commands/#port) | ⚠️ `@alpha` |
13+
[See](https://github.com/dankeboy36/vscode-arduino-api/blob/main/docs/README.md) the full API on GitHub.
3814

3915
## How to Use
4016

@@ -70,7 +46,7 @@ If you want to use the Arduino APIs, you have to do the followings:
7046
context.subscriptions.push(
7147
vscode.commands.registerCommand('myExtension.showSketchPath', () => {
7248
vscode.window.showInformationMessage(
73-
`Sketch path: ${arduinoContext.sketchPath}`
49+
`Sketch path: ${context.sketchPath}`
7450
);
7551
})
7652
);

docs/.nojekyll

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.

docs/README.md

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# vscode-arduino-api
2+
3+
## Table of contents
4+
5+
### Classes
6+
7+
- [Disposable](classes/Disposable.md)
8+
9+
### Interfaces
10+
11+
- [ArduinoContext](interfaces/ArduinoContext.md)
12+
- [ArduinoState](interfaces/ArduinoState.md)
13+
- [BoardDetails](interfaces/BoardDetails.md)
14+
- [ChangeEvent](interfaces/ChangeEvent.md)
15+
- [CliConfig](interfaces/CliConfig.md)
16+
- [CompileSummary](interfaces/CompileSummary.md)
17+
- [ConfigOption](interfaces/ConfigOption.md)
18+
- [ConfigValue](interfaces/ConfigValue.md)
19+
- [Event](interfaces/Event.md)
20+
- [Port](interfaces/Port.md)
21+
- [Programmer](interfaces/Programmer.md)
22+
- [SketchFolder](interfaces/SketchFolder.md)
23+
- [SketchFoldersChangeEvent](interfaces/SketchFoldersChangeEvent.md)
24+
25+
### Type Aliases
26+
27+
- [BoardIdentifier](README.md#boardidentifier)
28+
- [BuildProperties](README.md#buildproperties)
29+
- [Tool](README.md#tool)
30+
- [Version](README.md#version)
31+
32+
### Variables
33+
34+
- [ConfigOption](README.md#configoption)
35+
- [ConfigValue](README.md#configvalue)
36+
- [Port](README.md#port)
37+
- [Programmer](README.md#programmer)
38+
39+
## Type Aliases
40+
41+
### BoardIdentifier
42+
43+
Ƭ **BoardIdentifier**: `Nullable`\<`ApiBoard`, `"fqbn"`\>
44+
45+
Lightweight information to identify a board:
46+
47+
- The board's `name` is to provide a fallback for the UI. Preferably do not use this property for any sophisticated logic and board comparison. It must never participate in the board's identification.
48+
- The FQBN might contain boards config options if selected from the discovered ports (see [arduino/arduino-ide#1588](https://github.com/arduino/arduino-ide/issues/1588)).
49+
50+
---
51+
52+
### BuildProperties
53+
54+
Ƭ **BuildProperties**: `Readonly`\<`Record`\<`string`, `string`\>\>
55+
56+
Build properties used for compiling. The board-specific properties are retrieved from `board.txt` and `platform.txt`. For example, if the `board.txt` contains the `build.tarch=xtensa` entry for the `esp32:esp32:esp32` board, the record includes the `"build.tarch": "xtensa"` property.
57+
58+
---
59+
60+
### Tool
61+
62+
Ƭ **Tool**: `Readonly`\<`Pick`\<`ToolsDependencies`, `"name"` \| `"version"` \| `"packager"`\>\>
63+
64+
Required Tool dependencies of a board. See [`ToolsDependencies`](https://arduino.github.io/arduino-cli/latest/rpc/commands/#cc.arduino.cli.commands.v1.ToolsDependencies) for the CLI API.
65+
66+
---
67+
68+
### Version
69+
70+
Ƭ **Version**: `string`
71+
72+
Supposed to be a [SemVer](https://semver.org/) as a `string` but it's not enforced by Arduino. You might need to coerce the SemVer string.
73+
74+
## Variables
75+
76+
### ConfigOption
77+
78+
**ConfigOption**: `Object`
79+
80+
#### Type declaration
81+
82+
| Name | Type |
83+
| :------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
84+
| `create` | (`base?`: \{ `option?`: `string` ; `optionLabel?`: `string` ; `values?`: \{ `selected?`: `boolean` ; `value?`: `string` ; `valueLabel?`: `string` }[] }) => [`ConfigOption`](interfaces/ConfigOption.md) |
85+
| `decode` | (`input`: `Uint8Array` \| `Reader`, `length?`: `number`) => [`ConfigOption`](interfaces/ConfigOption.md) |
86+
| `encode` | (`message`: [`ConfigOption`](interfaces/ConfigOption.md), `writer?`: `Writer`) => `Writer` |
87+
| `fromJSON` | (`object`: `any`) => [`ConfigOption`](interfaces/ConfigOption.md) |
88+
| `fromPartial` | (`object`: \{ `option?`: `string` ; `optionLabel?`: `string` ; `values?`: \{ `selected?`: `boolean` ; `value?`: `string` ; `valueLabel?`: `string` }[] }) => [`ConfigOption`](interfaces/ConfigOption.md) |
89+
| `toJSON` | (`message`: [`ConfigOption`](interfaces/ConfigOption.md)) => `unknown` |
90+
91+
---
92+
93+
### ConfigValue
94+
95+
**ConfigValue**: `Object`
96+
97+
#### Type declaration
98+
99+
| Name | Type |
100+
| :------------ | :----------------------------------------------------------------------------------------------------------------------------------- |
101+
| `create` | (`base?`: \{ `selected?`: `boolean` ; `value?`: `string` ; `valueLabel?`: `string` }) => [`ConfigValue`](interfaces/ConfigValue.md) |
102+
| `decode` | (`input`: `Uint8Array` \| `Reader`, `length?`: `number`) => [`ConfigValue`](interfaces/ConfigValue.md) |
103+
| `encode` | (`message`: [`ConfigValue`](interfaces/ConfigValue.md), `writer?`: `Writer`) => `Writer` |
104+
| `fromJSON` | (`object`: `any`) => [`ConfigValue`](interfaces/ConfigValue.md) |
105+
| `fromPartial` | (`object`: \{ `selected?`: `boolean` ; `value?`: `string` ; `valueLabel?`: `string` }) => [`ConfigValue`](interfaces/ConfigValue.md) |
106+
| `toJSON` | (`message`: [`ConfigValue`](interfaces/ConfigValue.md)) => `unknown` |
107+
108+
---
109+
110+
### Port
111+
112+
**Port**: `Object`
113+
114+
#### Type declaration
115+
116+
| Name | Type |
117+
| :------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
118+
| `create` | (`base?`: \{ `address?`: `string` ; `hardwareId?`: `string` ; `label?`: `string` ; `properties?`: {} ; `protocol?`: `string` ; `protocolLabel?`: `string` }) => [`Port`](interfaces/Port.md) |
119+
| `decode` | (`input`: `Uint8Array` \| `Reader`, `length?`: `number`) => [`Port`](interfaces/Port.md) |
120+
| `encode` | (`message`: [`Port`](interfaces/Port.md), `writer?`: `Writer`) => `Writer` |
121+
| `fromJSON` | (`object`: `any`) => [`Port`](interfaces/Port.md) |
122+
| `fromPartial` | (`object`: \{ `address?`: `string` ; `hardwareId?`: `string` ; `label?`: `string` ; `properties?`: {} ; `protocol?`: `string` ; `protocolLabel?`: `string` }) => [`Port`](interfaces/Port.md) |
123+
| `toJSON` | (`message`: [`Port`](interfaces/Port.md)) => `unknown` |
124+
125+
---
126+
127+
### Programmer
128+
129+
**Programmer**: `Object`
130+
131+
#### Type declaration
132+
133+
| Name | Type |
134+
| :------------ | :----------------------------------------------------------------------------------------------------------------------- |
135+
| `create` | (`base?`: \{ `id?`: `string` ; `name?`: `string` ; `platform?`: `string` }) => [`Programmer`](interfaces/Programmer.md) |
136+
| `decode` | (`input`: `Uint8Array` \| `Reader`, `length?`: `number`) => [`Programmer`](interfaces/Programmer.md) |
137+
| `encode` | (`message`: [`Programmer`](interfaces/Programmer.md), `writer?`: `Writer`) => `Writer` |
138+
| `fromJSON` | (`object`: `any`) => [`Programmer`](interfaces/Programmer.md) |
139+
| `fromPartial` | (`object`: \{ `id?`: `string` ; `name?`: `string` ; `platform?`: `string` }) => [`Programmer`](interfaces/Programmer.md) |
140+
| `toJSON` | (`message`: [`Programmer`](interfaces/Programmer.md)) => `unknown` |

docs/classes/Disposable.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Class: Disposable
2+
3+
Represents a type which can release resources, such
4+
as event listening or a timer.
5+
6+
## Table of contents
7+
8+
### Constructors
9+
10+
- [constructor](Disposable.md#constructor)
11+
12+
### Methods
13+
14+
- [dispose](Disposable.md#dispose)
15+
- [from](Disposable.md#from)
16+
17+
## Constructors
18+
19+
### constructor
20+
21+
**new Disposable**(`callOnDispose`): [`Disposable`](Disposable.md)
22+
23+
Creates a new disposable that calls the provided function
24+
on dispose.
25+
26+
_Note_ that an asynchronous function is not awaited.
27+
28+
#### Parameters
29+
30+
| Name | Type | Description |
31+
| :-------------- | :---------- | :-------------------------------- |
32+
| `callOnDispose` | () => `any` | Function that disposes something. |
33+
34+
#### Returns
35+
36+
[`Disposable`](Disposable.md)
37+
38+
## Methods
39+
40+
### dispose
41+
42+
**dispose**(): `any`
43+
44+
Dispose this object.
45+
46+
#### Returns
47+
48+
`any`
49+
50+
---
51+
52+
### from
53+
54+
**from**(`...disposableLikes`): [`Disposable`](Disposable.md)
55+
56+
Combine many disposable-likes into one. You can use this method when having objects with
57+
a dispose function which aren't instances of `Disposable`.
58+
59+
#### Parameters
60+
61+
| Name | Type | Description |
62+
| :------------------- | :---------------------------- | :--------------------------------------------------------------------------------------------------------------- |
63+
| `...disposableLikes` | \{ `dispose`: () => `any` }[] | Objects that have at least a `dispose`-function member. Note that asynchronous dispose-functions aren't awaited. |
64+
65+
#### Returns
66+
67+
[`Disposable`](Disposable.md)
68+
69+
Returns a new disposable which, upon dispose, will
70+
dispose all provided disposables.

0 commit comments

Comments
 (0)