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

Commit bb2ce83

Browse files
elektronikworkshopadiazulay
authored andcommitted
Try to generate IntelliSense configuration even when the compilation fails
1 parent 819d2f1 commit bb2ce83

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

BRANCHNOTES.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,19 @@ Provide a configuration flag which allows the user to turn this feature off - th
4848
| | :white_check_mark: Auto-run verify after a) *setting a board* b) *changing the sketch*. We have to generate a valid `c_cpp_properties.json` to keep IntelliSense working in such situations. Identify other occasions where this applies (usually when adding new libraries), hint the user to run *verify*? -> Good moment would be after the workbench initialization -> message in arduino channel |
4949
| | :heavy_check_mark: Document configuration settings in [README.md](README.md) |
5050
| | :white_check_mark: Document features in [README.md](README.md) (partially done) |
51-
| | :white_check_mark: How to handle compilation failure? Only set if more comprehensive |
51+
| | :heavy_check_mark: Try to auto-generate even if verify (i.e. compilation) fails |
5252
| | :heavy_check_mark: Extract compiler command parser from vscode-arduino and [publish](https://itnext.io/step-by-step-building-and-publishing-an-npm-typescript-package-44fe7164964c) it as a separate package which will allow reusage and easy testing without heavy vscode-arduino rucksack. Done, see [cocopa](https://www.npmjs.com/package/cocopa) |
5353
| | :white_check_mark: Finally: go through my code and look for TODOs |
5454

5555
`*` not committed to branch yet
5656

5757
## Motivation
58-
I write a lot of code for Arduino, especially libraries. The Arduino IDE is not suited for more complex projects and I tried several alternatives. The old and dysfunctional Arduino CDT extension for eclipse somehow stalled (even if it was promising), Sloeber could be an option but the maintainer is disillusioned and the project is more or less dead. Platform IO IDE's license is very [restrictive](https://community.platformio.org/t/what-part-of-platformio-is-open-source-licenced/1447/2).
58+
I write a lot of code for Arduino, especially libraries. The Arduino IDE is not suited for more complex projects and I tried several alternatives:
59+
* The old and dysfunctional Arduino CDT extension for eclipse somehow stalled (even if it was promising)
60+
* Sloeber could be an option but the maintainer is disillusioned and the project is more or less dead. Furthermore Eclipse is pretty heavy and less accessible to beginners
61+
* Platform IO IDE's license is very [restrictive](https://community.platformio.org/t/what-part-of-platformio-is-open-source-licenced/1447/2).
5962

60-
Then remains vscode-arduino. It seems that it isn't completely dead - but almost. Most of the core functionality seems to work (I used it a few days now). But the biggest show stopper is the bad IntelliSense support.
63+
Then remains vscode-arduino. It seems that it isn't completely dead - but almost. Most of the core functionality seems to work (I used it a few days now). But the biggest show stopper is the bad IntelliSense support -- which I'll address here now.
6164

6265
## Beer Money :beers:
6366
You can chip in some beer money to keep me motivated - this is really appreciated.

src/arduino/arduino.ts

+12-9
Original file line numberDiff line numberDiff line change
@@ -256,29 +256,32 @@ export class ArduinoApp {
256256

257257
arduinoChannel.show();
258258

259-
try {
260-
const compilerParserContext = this.makeCompilerParserContext(dc);
259+
let verifyResult: boolean;
260+
const compilerParserContext = this.makeCompilerParserContext(dc);
261261

262+
try {
262263
await util.spawn(this._settings.commandPath,
263264
arduinoChannel.channel,
264265
args,
265266
undefined,
266267
compilerParserContext.callback);
267-
268-
if (compilerParserContext.conclude) {
269-
compilerParserContext.conclude();
270-
}
271-
arduinoChannel.end(`Finished verify sketch - ${dc.sketch}${os.EOL}`);
272-
return true;
268+
arduinoChannel.end(`Finished verifying sketch - ${dc.sketch}${os.EOL}`);
269+
verifyResult = true;
273270
} catch (reason) {
274271
const msg = reason.code ?
275272
`Exit with code=${reason.code}${os.EOL}` :
276273
reason.message ?
277274
reason.message :
278275
JSON.stringify(reason);
279276
arduinoChannel.error(msg);
280-
return false;
277+
verifyResult = false;
278+
}
279+
280+
if (compilerParserContext.conclude) {
281+
compilerParserContext.conclude();
281282
}
283+
284+
return verifyResult;
282285
}
283286

284287
public tryToUpdateIncludePaths() {

0 commit comments

Comments
 (0)