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

Commit dd3254d

Browse files
elektronikworkshopadiazulay
authored andcommitted
Incorporated the latest progress from cocopa development
1 parent bb2ce83 commit dd3254d

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

BRANCHNOTES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Provide a configuration flag which allows the user to turn this feature off - th
1919
**2020-02-05** Currently I'm able to generate error free IntelliSense setups for AVR and ESP32 using the preliminary implementation. For ESP32 I just had to add the intrinsic compiler paths manually. A solution has to be found for these ... which there is, see [here](https://stackoverflow.com/a/6666338)
2020
**2020-02-06** Got it fully working (with built-in include directories) for AVR, ESP32, ESP8266. Rewrote the backend to facilitate writing of further parser engines in the future.
2121
**2020-02-07** Wrote compiler command parser npm package [cocopa](https://www.npmjs.com/package/cocopa) and began writing a test framework for it. Added a global configuration switch which allows the IntelliSense configuration generation to be turned off.
22-
**2020-02-08** Integrated `cocopa` into vscode-arduino. Added project configuration flag which can override the global flag in both ways (forced off, forced on). Made code tslint compliant. Began some documentation in [README.md](README.md)
22+
**2020-02-08** Integrated `cocopa` into vscode-arduino. Added project configuration flag which can override the global flag in both ways (forced off, forced on). Made code tslint compliant. Began some documentation in [README.md](README.md). vscode-arduino now tries to generate an IntelliSense configuration even if compilation (verify) should fail. vscode-arduino now tries to generate a IntelliSense configuration even if Arduino's verify failed (if the main sketch compilation was invoked before anything failed)
2323

2424
| | Tasks |
2525
|-----:|:--------|

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@
595595
"dependencies": {
596596
"body-parser": "^1.16.1",
597597
"child_process": "^1.0.2",
598-
"cocopa": "0.0.3",
598+
"cocopa": "0.0.4",
599599
"compare-versions": "^3.4.0",
600600
"eventemitter2": "^4.1.0",
601601
"express": "^4.14.1",

src/arduino/arduino.ts

+17-3
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,8 @@ export class ArduinoApp {
815815
if (project !== "disable" && !globalDisable ||
816816
project === "enable") {
817817

818-
// setup the parser with its engines
819-
const gccParserEngine = new ccp.ParserGcc(dc.sketch);
820-
const compilerParser = new ccp.Runner([gccParserEngine]);
818+
const parserEngines = this.makeCompilerParserEngines(dc);
819+
const compilerParser = new ccp.Runner(parserEngines);
821820

822821
// set up the function to be called after parsing
823822
const _conclude = () => {
@@ -839,6 +838,21 @@ export class ArduinoApp {
839838
}
840839
};
841840

841+
private makeCompilerParserEngines(dc: DeviceContext) {
842+
const matchPattern = [
843+
// trigger parser when compiling the main sketch
844+
` ${path.basename(dc.sketch)}.cpp.o`,
845+
];
846+
const dontMatchPattern = [
847+
// make sure Arduino's not testing libraries
848+
/-o\s\/dev\/null/,
849+
];
850+
851+
// setup the parser with its engines
852+
const gccParserEngine = new ccp.ParserGcc(matchPattern, dontMatchPattern);
853+
return [gccParserEngine];
854+
}
855+
842856
private getProgrammerString(): string {
843857
const selectProgrammer = this.programmerManager.currentProgrammer;
844858
if (!selectProgrammer) {

0 commit comments

Comments
 (0)