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

Commit 0865c97

Browse files
elektronikworkshopadiazulay
authored andcommitted
Moved compiler parser to cocopa package for better testability and maintainability
1 parent d337295 commit 0865c97

File tree

6 files changed

+63
-374
lines changed

6 files changed

+63
-374
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-lock.json

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

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -588,15 +588,18 @@
588588
"plugin-error": "^1.0.1",
589589
"tslint": "^5.20.1",
590590
"typemoq": "^1.6.0",
591-
"typescript": "^2.2.1",
591+
"typescript": "^3.7.5",
592592
"vscode-test": "^1.4.0",
593593
"webpack": "^4.44.1"
594594
},
595595
"dependencies": {
596596
"body-parser": "^1.16.1",
597+
"child_process": "^1.0.2",
598+
"cocopa": "0.0.3",
597599
"compare-versions": "^3.4.0",
598600
"eventemitter2": "^4.1.0",
599601
"express": "^4.14.1",
602+
"fs": "0.0.1-security",
600603
"glob": "^7.1.1",
601604
"iconv-lite": "^0.4.18",
602605
"impor": "^0.1.1",

src/arduino/arduino.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4+
import * as ccp from "cocopa";
45
import * as fs from "fs";
56
import * as glob from "glob";
67
import * as os from "os";
@@ -22,7 +23,6 @@ import { arduinoChannel } from "../common/outputChannel";
2223
import { ArduinoWorkspace } from "../common/workspace";
2324
import { SerialMonitor } from "../serialmonitor/serialMonitor";
2425
import { UsbDetector } from "../serialmonitor/usbDetector";
25-
import { CCppProperties, CompilerCmdParser, CompilerCmdParserEngineGcc } from "./intellisense";
2626
import { ProgrammerManager } from "./programmerManager";
2727

2828
/**
@@ -808,8 +808,8 @@ export class ArduinoApp {
808808
if (!VscodeSettings.getInstance().disableIntelliSenseAutoGen) {
809809

810810
// setup the parser with its engines
811-
const gccParserEngine = new CompilerCmdParserEngineGcc(dc.sketch);
812-
const compilerParser = new CompilerCmdParser([gccParserEngine]);
811+
const gccParserEngine = new ccp.ParserGcc(dc.sketch);
812+
const compilerParser = new ccp.Runner([gccParserEngine]);
813813

814814
// set up the function to be called after parsing
815815
const _conclude = () => {
@@ -821,7 +821,7 @@ export class ArduinoApp {
821821
}
822822
};
823823
return {
824-
callback: compilerParser.callback,
824+
callback: compilerParser.callback(),
825825
conclude: _conclude,
826826
};
827827
}

0 commit comments

Comments
 (0)