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

Commit fdf4076

Browse files
authored
fix intellisense issue
1 parent ee63dca commit fdf4076

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/arduino/arduino.ts

+22-3
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export class ArduinoApp {
240240
} else {
241241
configSection.includePath = [];
242242
}
243-
configSection.includePath.push(childLibPath);
243+
configSection.includePath.unshift(childLibPath);
244244
});
245245

246246
libPaths.forEach((childLibPath) => {
@@ -254,7 +254,7 @@ export class ArduinoApp {
254254
} else {
255255
configSection.browse.path = [];
256256
}
257-
configSection.browse.path.push(childLibPath);
257+
configSection.browse.path.unshift(childLibPath);
258258
});
259259

260260
fs.writeFileSync(configFilePath, JSON.stringify(deviceContext, null, 4));
@@ -437,14 +437,33 @@ export class ArduinoApp {
437437

438438
// Generate cpptools intellisense config
439439
const cppConfigFilePath = path.join(destExample, constants.CPP_CONFIG_FILE);
440+
441+
// Current workspace
442+
const includePath = ["${workspaceRoot}"];
443+
// Defaut package for this board
444+
includePath.concat(this.getDefaultPackageLibPaths());
445+
// Arduino built-in package tools
446+
includePath.push(path.join(this._settings.arduinoPath, "hardware", "tools"));
447+
// Arduino built-in libraries
448+
includePath.push(path.join(this._settings.arduinoPath, "libraries"));
449+
// Arduino custom package tools
450+
includePath.push(path.join(os.homedir(), "Documents", "Arduino", "hardware", "tools"));
451+
// Arduino custom libraries
452+
includePath.push(path.join(os.homedir(), "Documents", "Arduino", "libraries"));
453+
440454
const cppConfig = {
441455
configurations: [{
442456
name: util.getCppConfigPlatform(),
443-
includePath: this.getDefaultPackageLibPaths(),
457+
includePath,
444458
browse: {
459+
path: includePath,
445460
limitSymbolsToIncludedHeaders: false,
446461
},
462+
intelliSenseMode: "clang-x64",
463+
cStandard: "c11",
464+
cppStandard: "c++17",
447465
}],
466+
version: 3,
448467
};
449468
util.mkdirRecursivelySync(path.dirname(cppConfigFilePath));
450469
fs.writeFileSync(cppConfigFilePath, JSON.stringify(cppConfig, null, 4));

0 commit comments

Comments
 (0)