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

Commit 085e5f8

Browse files
elektronikworkshophlovdal
authored andcommitted
Moved compiler parser to cocopa package for better testability and maintainability
1 parent 07c9882 commit 085e5f8

File tree

4 files changed

+9
-378
lines changed

4 files changed

+9
-378
lines changed

BRANCHNOTES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Provide a configuration flag which allows the user to turn this feature off - th
3636
| | :white_check_mark: Option to backup old configurations? |
3737
| **Configuration flags** | :heavy_check_mark: Provide global disable flag for IntelliSense auto-config |
3838
| | :white_check_mark: Provide project specific override for the global flag - most users will likely use the default setup and disable auto-generation for very specific projects |
39-
| **Unit tests** | :white_check_mark: Basic parser (known boards, match/no match)|
40-
| | :white_check_mark: Querying of compiler built-in includes |
39+
| **Unit tests** | :heavy_check_mark: Basic parser (known boards, match/no match)|
40+
| | :heavy_check_mark: Querying of compiler built-in includes (Note: to be changed to generic compiler such that Arduino is not necessary for unit testing) |
4141
| | :white_check_mark: Throwing arbitrary data at parser engines |
4242
| | :white_check_mark: JSON input |
4343
| | :white_check_mark: JSON output |
@@ -47,7 +47,7 @@ Provide a configuration flag which allows the user to turn this feature off - th
4747
| | :white_check_mark: Document configuration settings in [README.md](README.md) |
4848
| | :white_check_mark: Document features in [README.md](README.md) |
4949
| | :white_check_mark: How to handle compilation failure? Only set if more comprehensive |
50-
| | :white_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 tests can be run without the heavy vscode-arduino rucksack |
50+
| | :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) |
5151
| | :white_check_mark: Finally: go through my code and look for TODOs |
5252

5353
`*` not committed to branch yet

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -575,12 +575,13 @@
575575
"plugin-error": "^1.0.1",
576576
"tslint": "^5.20.1",
577577
"typemoq": "^1.6.0",
578-
"typescript": "^2.2.1",
578+
"typescript": "^3.7.5",
579579
"vscode-test": "^1.4.0",
580580
"webpack": "^4.44.1"
581581
},
582582
"dependencies": {
583583
"body-parser": "^1.16.1",
584+
"cocopa": "0.0.3",
584585
"compare-versions": "^3.4.0",
585586
"eventemitter2": "^4.1.0",
586587
"express": "^4.14.1",

src/arduino/arduino.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as glob from "glob";
66
import * as os from "os";
77
import * as path from "path";
88
import * as vscode from "vscode";
9+
import * as ccp from "cocopa";
910

1011
import * as constants from "../common/constants";
1112
import * as util from "../common/util";
@@ -23,7 +24,6 @@ import { ArduinoWorkspace } from "../common/workspace";
2324
import { SerialMonitor } from "../serialmonitor/serialMonitor";
2425
import { UsbDetector } from "../serialmonitor/usbDetector";
2526
import { ProgrammerManager } from "./programmerManager";
26-
import { CompilerCmdParserEngineGcc, CompilerCmdParser, CCppProperties } from "./intellisense";
2727

2828
/**
2929
* Represent an Arduino application based on the official Arduino IDE.
@@ -353,8 +353,8 @@ export class ArduinoApp {
353353
if (!VscodeSettings.getInstance().disableIntelliSenseAutoGen) {
354354

355355
// setup the parser with its engines
356-
let gccParserEngine = new CompilerCmdParserEngineGcc(dc.sketch);
357-
let compilerParser = new CompilerCmdParser([gccParserEngine]);
356+
let gccParserEngine = new ccp.ParserGcc(dc.sketch);
357+
let compilerParser = new ccp.Runner([gccParserEngine]);
358358

359359
// set up the function to be called after parsing
360360
let _conclude = () => {
@@ -366,7 +366,7 @@ export class ArduinoApp {
366366
}
367367
};
368368
return {
369-
callback: compilerParser.callback,
369+
callback: compilerParser.callback(),
370370
conclude: _conclude,
371371
};
372372
}

0 commit comments

Comments
 (0)