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

Commit 77ecca1

Browse files
elektronikworkshophlovdal
authored andcommitted
Try to generate IntelliSense configuration even when the compilation fails
1 parent 60f4d5e commit 77ecca1

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
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

+13-10
Original file line numberDiff line numberDiff line change
@@ -287,29 +287,32 @@ export class ArduinoApp {
287287

288288
arduinoChannel.show();
289289

290-
try {
291-
const compilerParserContext = this.makeCompilerParserContext(dc);
290+
let verifyResult: boolean;
291+
const compilerParserContext = this.makeCompilerParserContext(dc);
292292

293+
try {
293294
await util.spawn(this._settings.commandPath,
294295
arduinoChannel.channel,
295296
args,
296297
{},
297298
compilerParserContext.callback);
298-
299-
if (compilerParserContext.conclude) {
300-
compilerParserContext.conclude();
301-
}
302-
arduinoChannel.end(`Finished verify sketch - ${dc.sketch}${os.EOL}`);
303-
return true;
299+
arduinoChannel.end(`Finished verifying sketch - ${dc.sketch}${os.EOL}`);
300+
verifyResult = true;
304301
} catch (reason) {
305302
const msg = reason.code ?
306303
`Exit with code=${reason.code}${os.EOL}` :
307304
reason.message ?
308305
reason.message :
309306
JSON.stringify(reason);
310307
arduinoChannel.error(msg);
311-
return false;
308+
verifyResult = false;
312309
}
310+
311+
if (compilerParserContext.conclude) {
312+
compilerParserContext.conclude();
313+
}
314+
315+
return verifyResult;
313316
}
314317

315318
public tryToUpdateIncludePaths() {
@@ -797,7 +800,7 @@ Please make sure the folder is not occupied by other procedures .`);
797800
conclude: _conclude,
798801
}
799802
}
800-
// const donothing = () => void {};
803+
801804
return {
802805
callback: undefined,
803806
conclude: undefined,

0 commit comments

Comments
 (0)