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

Commit 4238e12

Browse files
elektronikworkshopadiazulay
authored andcommitted
Updated to latest cocopa which features X-platform support and better lexer
1 parent e6c10cd commit 4238e12

File tree

3 files changed

+47
-37
lines changed

3 files changed

+47
-37
lines changed

package-lock.json

+32-12
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
@@ -604,7 +604,7 @@
604604
},
605605
"dependencies": {
606606
"body-parser": "^1.16.1",
607-
"cocopa": "^0.0.7",
607+
"cocopa": "^0.0.8",
608608
"compare-versions": "^3.4.0",
609609
"eventemitter2": "^4.1.0",
610610
"express": "^4.14.1",

src/arduino/intellisense.ts

+14-24
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ export function isCompilerParserEnabled(dc?: DeviceContext) {
4040
* and keeps the calling context more readable.
4141
*
4242
* @param dc The device context of the caller.
43+
*
44+
* Possible enhancements:
45+
*
46+
* * Parse c++ standard from arduino command line
47+
*
48+
* Arduino currently sets the C++ standard during compilation with the
49+
* flag -std=gnu++11
50+
*
4351
*/
4452
export function makeCompilerParserContext(dc: DeviceContext): ICoCoPaContext {
4553

@@ -92,29 +100,9 @@ export function makeCompilerParserContext(dc: DeviceContext): ICoCoPaContext {
92100
* @param dc Current device context used to generate the engines.
93101
*/
94102
function makeCompilerParserEngines(dc: DeviceContext) {
95-
96-
let sketch = path.basename(dc.sketch);
97-
const dotcpp = sketch.endsWith(".ino") ? ".cpp" : "";
98-
sketch = `-o\\s+\\S*${ccp.regExEscape(sketch)}${dotcpp}\\.o`;
99-
100-
// TODO: handle other architectures here
101-
102-
const matchPattern = [
103-
// make sure we're running g++
104-
/(?:^|-)g\+\+\s+/,
105-
// make sure we're compiling
106-
/\s+-c\s+/,
107-
// trigger parser when compiling the main sketch
108-
RegExp(sketch),
109-
];
110-
111-
const dontMatchPattern = [
112-
// make sure Arduino's not testing libraries
113-
/-o\s+\/dev\/null/,
114-
];
115-
116-
// setup the parser with its engines
117-
const gccParserEngine = new ccp.ParserGcc(matchPattern, dontMatchPattern);
103+
const sketch = path.basename(dc.sketch);
104+
const trigger = ccp.getTriggerForArduinoGcc(sketch);
105+
const gccParserEngine = new ccp.ParserGcc(trigger);
118106
return [gccParserEngine];
119107
}
120108

@@ -286,8 +274,10 @@ export class AnalysisManager {
286274
clearTimeout(this._timer);
287275
}
288276
this._timer = setTimeout(() => {
289-
this.update(AnalysisEvent.WaitTimeout);
277+
// reset timer variable first - calling update can cause
278+
// the timer to be restarted.
290279
this._timer = undefined;
280+
this.update(AnalysisEvent.WaitTimeout);
291281
}, this._waitPeriodMs);
292282
}
293283

0 commit comments

Comments
 (0)