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

Commit 5fe6dbc

Browse files
elektronikworkshopadiazulay
authored andcommitted
IntelliSense config generator
* Now normalizes generated include paths * Bumped cocopa to 0.0.9
1 parent 4238e12 commit 5fe6dbc

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

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

src/arduino/intellisense.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ export function isCompilerParserEnabled(dc?: DeviceContext) {
4848
* Arduino currently sets the C++ standard during compilation with the
4949
* flag -std=gnu++11
5050
*
51+
* * Order of includes: Perhaps insert the internal includes at the front
52+
* as at least for the forcedIncludes IntelliSense seems to take the
53+
* order into account.
5154
*/
5255
export function makeCompilerParserContext(dc: DeviceContext): ICoCoPaContext {
5356

@@ -60,7 +63,10 @@ export function makeCompilerParserContext(dc: DeviceContext): ICoCoPaContext {
6063
arduinoChannel.warning("Failed to generate IntelliSense configuration.");
6164
return;
6265
}
63-
const pPath = path.join(ArduinoWorkspace.rootPath, constants.CPP_CONFIG_FILE);
66+
67+
// Normalize compiler and include paths (resolve ".." and ".")
68+
runner.result.normalize();
69+
6470
// TODO: check what kind of result we've got: gcc or other architecture:
6571
// and instantiate content accordingly (to be implemented within cocopa)
6672
const content = new ccp.CCppPropertiesContentResult(runner.result,
@@ -70,6 +76,7 @@ export function makeCompilerParserContext(dc: DeviceContext): ICoCoPaContext {
7076
// as of 1.8.11 arduino is on C++11
7177
ccp.CCppPropertiesCppStandard.Cpp11);
7278
try {
79+
const pPath = path.join(ArduinoWorkspace.rootPath, constants.CPP_CONFIG_FILE);
7380
const prop = new ccp.CCppProperties();
7481
prop.read(pPath);
7582
prop.merge(content, ccp.CCppPropertiesMergeMode.ReplaceSameNames);

0 commit comments

Comments
 (0)