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

Commit 41bcd44

Browse files
elektronikworkshopadiazulay
authored andcommitted
Disabled and marked all previous implementations of IntelliSense support for later removal using IS-REMOVE
1 parent 3418458 commit 41bcd44

11 files changed

+77
-11
lines changed

BRANCHNOTES.md

+20
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ During merging I found some bugs within those functions - mainly due to the abov
3535
* Error message formatting was fixed within `verify` only
3636
* No consistent return values within `verify` (when it bailed out early it returned `void`)
3737

38+
**2020 02 17** Disabled and marked all previous implementations of IntelliSense support for later removal.
39+
3840
### Status
3941
| | Tasks |
4042
|-----:|:--------|
@@ -99,6 +101,7 @@ I will list every supporter here, thanks!
99101
2020-02-12 Elektronik Workshop: 32 :beers: (8h coding)
100102
2020-02-15 T.D.: 4 :beers: (20$ - Thanks a lot!)
101103
2020-02-15 Elektronik Workshop: 28 :beers: (7h coding)
104+
2020-02-16 Elektronik Workshop: x :beers: (xh coding)
102105

103106
<!-- https://github.com/StylishThemes/GitHub-Dark/wiki/Emoji -->
104107

@@ -116,6 +119,7 @@ I will list every supporter here, thanks!
116119
* https://github.com/Microsoft/vscode-cpptools/issues/1750
117120
* Problems with IntelliSense itself https://github.com/microsoft/vscode-cpptools/issues/1034
118121
* Logging for IntelliSense https://code.visualstudio.com/docs/cpp/enable-logging-cpp
122+
119123
## Future Work
120124
* Proper interactive serial terminal (this is the second major show stopper in my opinion)
121125
* Command history option
@@ -140,6 +144,22 @@ I will list every supporter here, thanks!
140144
* general lack of modularity - the above is the result
141145
* It seems that this extension is pretty chaotic. Most probably some refactoring is necessary.
142146
* Possibility to jump to compilation errors from compiler output and highlight compiler errors
147+
148+
## Non-categorized Notes
149+
### Integrate upstream changes into fork
150+
```bash
151+
git remote add upstream https://github.com/microsoft/vscode-arduino.git
152+
git remote -v
153+
git fetch upstream
154+
# make sure your working directory is clean, then
155+
git checkout master
156+
git merge upstream/master
157+
git push origin master
158+
# to pull the changes into you feature branch:
159+
git checkout intellisense-autoconfig
160+
git merge master
161+
git push origin intellisense-autoconfig
162+
```
143163
----
144164

145165
## How to beta test cutting edge code from the repo

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"onCommand:arduino.selectProgrammer",
4242
"onCommand:arduino.selectSerialPort",
4343
"onCommand:arduino.changeBaudRate",
44-
"onCommand:arduino.addLibPath",
4544
"onCommand:arduino.openSerialMonitor",
4645
"onCommand:arduino.sendMessageToSerialPort",
4746
"onCommand:arduino.closeSerialMonitor",

src/arduino/arduino.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ export class ArduinoApp {
317317
return success;
318318
}
319319

320+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
321+
/*
320322
public tryToUpdateIncludePaths() {
321323
const configFilePath = path.join(ArduinoWorkspace.rootPath, constants.CPP_CONFIG_FILE);
322324
if (!fs.existsSync(configFilePath)) {
@@ -358,6 +360,7 @@ export class ArduinoApp {
358360
configuration.defines.push(define);
359361
}
360362
}
363+
*/
361364
// remove all unexisting paths
362365
// concern mistake removal, comment temporary
363366
// for (let pathIndex = 0; pathIndex < configuration.includePath.length; pathIndex++) {
@@ -385,12 +388,15 @@ export class ArduinoApp {
385388
// pathIndex--;
386389
// }
387390
// }
388-
391+
/*
389392
if (cppConfigFileUpdated) {
390393
fs.writeFileSync(configFilePath, JSON.stringify(cppConfig, null, 4));
391394
}
392395
}
396+
*/
393397

398+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
399+
/*
394400
// Add selected library path to the intellisense search path.
395401
public addLibPath(libraryPath: string) {
396402
let libPaths;
@@ -466,7 +472,7 @@ export class ArduinoApp {
466472
467473
fs.writeFileSync(configFilePath, JSON.stringify(deviceContext, null, 4));
468474
}
469-
475+
*/
470476
// Include the *.h header files from selected library to the arduino sketch.
471477
public async includeLibrary(libraryPath: string) {
472478
if (!ArduinoWorkspace.rootPath) {
@@ -610,6 +616,8 @@ export class ArduinoApp {
610616
arduinoChannel.end(`Removed library - ${libName}${os.EOL}`);
611617
}
612618

619+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
620+
/*
613621
public getDefaultPackageLibPaths(): string[] {
614622
const result = [];
615623
const boardDescriptor = this._boardManager.currentBoard;
@@ -644,8 +652,10 @@ export class ArduinoApp {
644652
result.push(path.normalize(path.join(toolPath, "**")));
645653
}
646654
return result;
647-
}
655+
}*/
648656

657+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
658+
/*
649659
public getDefaultForcedIncludeFiles(): string[] {
650660
const result = [];
651661
const boardDescriptor = this._boardManager.currentBoard;
@@ -665,6 +675,7 @@ export class ArduinoApp {
665675
result.push("USBCON");
666676
return result;
667677
}
678+
*/
668679

669680
public openExample(example) {
670681
function tmpName(name) {
@@ -705,6 +716,7 @@ export class ArduinoApp {
705716
const dc = DeviceContext.getInstance();
706717
const arduinoJson = {
707718
sketch: sketchFile,
719+
// TODO: COM1 is Windows specific - what about OSX and Linux users?
708720
port: dc.port || "COM1",
709721
board: dc.board,
710722
configuration: dc.configuration,
@@ -713,6 +725,8 @@ export class ArduinoApp {
713725
util.mkdirRecursivelySync(path.dirname(arduinoConfigFilePath));
714726
fs.writeFileSync(arduinoConfigFilePath, JSON.stringify(arduinoJson, null, 4));
715727

728+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
729+
/*
716730
// Generate cpptools intellisense config
717731
const cppConfigFilePath = path.join(destExample, constants.CPP_CONFIG_FILE);
718732
@@ -749,6 +763,7 @@ export class ArduinoApp {
749763
};
750764
util.mkdirRecursivelySync(path.dirname(cppConfigFilePath));
751765
fs.writeFileSync(cppConfigFilePath, JSON.stringify(cppConfig, null, 4));
766+
*/
752767
}
753768

754769
// Step 3: Open the arduino project at a new vscode window.

src/arduino/arduinoContentProvider.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ export class ArduinoContentProvider implements vscode.TextDocumentContentProvide
206206
return res.status(400).send("BAD Request! Missing { libraryPath } parameters!");
207207
} else {
208208
try {
209-
await ArduinoContext.arduinoApp.addLibPath(req.body.libraryPath);
209+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
210+
// await ArduinoContext.arduinoApp.addLibPath(req.body.libraryPath);
210211
await ArduinoContext.arduinoApp.includeLibrary(req.body.libraryPath);
211212
return res.json({
212213
status: "OK",

src/arduino/boardManager.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ export class BoardManager {
123123
this._currentBoard = targetBoard;
124124
dc.configuration = this._currentBoard.customConfig;
125125
this._boardConfigStatusBar.text = targetBoard.name;
126-
this._arduinoApp.addLibPath(null);
126+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
127+
// this._arduinoApp.addLibPath(null);
127128

128129
this._onBoardTypeChanged.fire();
129130
}

src/common/util.ts

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { arduinoChannel } from "./outputChannel";
1313

1414
const encodingMapping: object = JSON.parse(fs.readFileSync(path.join(__dirname, "../../../misc", "codepageMapping.json"), "utf8"));
1515

16+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
1617
/**
1718
* This function will return the VSCode C/C++ extesnion compatible platform literals.
1819
* @function getCppConfigPlatform

src/extension.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ export async function activate(context: vscode.ExtensionContext) {
254254
};
255255
});
256256

257-
registerArduinoCommand("arduino.addLibPath", (path) => arduinoContextModule.default.arduinoApp.addLibPath(path));
257+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
258+
// registerArduinoCommand("arduino.addLibPath", (path) => arduinoContextModule.default.arduinoApp.addLibPath(path));
258259
registerArduinoCommand("arduino.openExample", (path) => arduinoContextModule.default.arduinoApp.openExample(path));
259260
registerArduinoCommand("arduino.loadPackages", async () => await arduinoContextModule.default.boardManager.loadPackages(true));
260261
registerArduinoCommand("arduino.installBoard", async (packageName, arch, version: string = "") => {
@@ -308,7 +309,8 @@ export async function activate(context: vscode.ExtensionContext) {
308309
SerialMonitor.getInstance().initialize();
309310
}
310311
arduinoContextModule.default.boardManager.updateStatusBar(true);
311-
arduinoContextModule.default.arduinoApp.tryToUpdateIncludePaths();
312+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
313+
// arduinoContextModule.default.arduinoApp.tryToUpdateIncludePaths();
312314
vscode.commands.executeCommand("setContext", "vscode-arduino:showExampleExplorer", true);
313315
})();
314316
}

src/langService/completionProvider.ts

+22-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@ import ArduinoActivator from "../arduinoActivator";
1212
import ArduinoContext from "../arduinoContext";
1313
import { ArduinoWorkspace } from "../common/workspace";
1414

15+
/**
16+
* Provides completions for library header includes.
17+
*
18+
* NOTE: With the new IntelliSense auto-configuration this doesn't make
19+
* much sense in its current state, since it tries to fetch includes
20+
* from the wrongly guessed include paths. And it tries to fetch includes
21+
* from the c_cpp_properties which is now automatically generated from the
22+
* files already included -> therefore the user already included the header
23+
* and doesn't need a completion. Furthermore IntelliSense knows the location
24+
* as well and can complete it too.
25+
*
26+
* To make this useful it has to parse the actual library folders and then
27+
* it makes only sense if it reads the library information and checks if
28+
* the individual libraries are actually compatible with the current board
29+
* before offering a completion.
30+
*
31+
* EW
32+
* 2020-02-17
33+
*/
1534
export class CompletionProvider implements vscode.CompletionItemProvider {
1635

1736
private _headerFiles = new Set<string>();
@@ -65,10 +84,12 @@ export class CompletionProvider implements vscode.CompletionItemProvider {
6584
}
6685
this._libPaths.clear();
6786
this._headerFiles.clear();
87+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
88+
/*
6889
ArduinoContext.arduinoApp.getDefaultPackageLibPaths().forEach((defaultPath) => {
6990
this._libPaths.add(defaultPath);
7091
});
71-
92+
*/
7293
if (fs.existsSync(this._cppConfigFile)) {
7394
const deviceConfig = util.tryParseJSON(fs.readFileSync(this._cppConfigFile, "utf8"));
7495
if (deviceConfig) {

test/boardmanager.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ suite("Arduino: Board Manager.", () => {
2828
const arduinoApp = TypeMoq.Mock.ofType(ArduinoApp);
2929
arduinoApp.setup((x) => x.setPref(TypeMoq.It.isAny(), TypeMoq.It.isAny()));
3030
arduinoApp.setup((x) => x.initialize(TypeMoq.It.isAny()));
31-
arduinoApp.setup((x) => x.addLibPath(TypeMoq.It.isAny()));
31+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
32+
// arduinoApp.setup((x) => x.addLibPath(TypeMoq.It.isAny()));
3233

3334
try {
3435
boardManager = new BoardManager(arduinoSettings.object, arduinoApp.object);

test/commands.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ suite("Arduino: Commands Tests", () => {
3838
}
3939
});
4040

41+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
4142
// Arduino: Library Manager: Add library to include path.
4243
// tslint:disable-next-line: only-arrow-functions
44+
/*
4345
test("should be able to run command: arduino.addLibPath", function(done) {
4446
this.timeout(60 * 1000);
4547
try {
@@ -52,6 +54,7 @@ suite("Arduino: Commands Tests", () => {
5254
done(new Error(error));
5355
}
5456
});
57+
*/
5558

5659
// Arduino: Boards Manager : Manage packages for boards
5760
// tslint:disable-next-line: only-arrow-functions

test/extension.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ suite("Arduino: Extension Tests", () => {
4545
"arduino.showExamples",
4646
"arduino.changeBoardType",
4747
"arduino.initialize",
48-
"arduino.addLibPath",
48+
// IS-REMOVE: to be removed completely when IntelliSense implementation is merged
49+
// note: it has been removed from package.json commands already
50+
// "arduino.addLibPath",
4951
"arduino.selectSerialPort",
5052
"arduino.openSerialMonitor",
5153
"arduino.changeBaudRate",

0 commit comments

Comments
 (0)