Skip to content

Commit 28586df

Browse files
Incorporated the latest progress from cocopa development
1 parent 6f36565 commit 28586df

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
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.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@
576576
},
577577
"dependencies": {
578578
"body-parser": "^1.16.1",
579-
"cocopa": "0.0.3",
579+
"cocopa": "0.0.4",
580580
"compare-versions": "^3.4.0",
581581
"eventemitter2": "^4.1.0",
582582
"express": "^4.14.1",

src/arduino/arduino.ts

+17-3
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,8 @@ Please make sure the folder is not occupied by other procedures .`);
782782
if (project !== "disable" && !globalDisable ||
783783
project === "enable") {
784784

785-
// setup the parser with its engines
786-
const gccParserEngine = new ccp.ParserGcc(dc.sketch);
787-
const compilerParser = new ccp.Runner([gccParserEngine]);
785+
const parserEngines = this.makeCompilerParserEngines(dc);
786+
const compilerParser = new ccp.Runner(parserEngines);
788787

789788
// set up the function to be called after parsing
790789
const _conclude = () => {
@@ -807,6 +806,21 @@ Please make sure the folder is not occupied by other procedures .`);
807806
}
808807
};
809808

809+
private makeCompilerParserEngines(dc: DeviceContext) {
810+
const matchPattern = [
811+
// trigger parser when compiling the main sketch
812+
` ${path.basename(dc.sketch)}.cpp.o`,
813+
];
814+
const dontMatchPattern = [
815+
// make sure Arduino's not testing libraries
816+
/-o\s\/dev\/null/,
817+
];
818+
819+
// setup the parser with its engines
820+
const gccParserEngine = new ccp.ParserGcc(matchPattern, dontMatchPattern);
821+
return [gccParserEngine];
822+
}
823+
810824
private getProgrammerString(): string {
811825
const selectProgrammer = this.programmerManager.currentProgrammer;
812826
if (!selectProgrammer) {

0 commit comments

Comments
 (0)