You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 1, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: BRANCHNOTES.md
+79-39
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,54 @@
1
1
# IntelliSense Autoconfiguration Branch
2
2
## Problem
3
-
This branch more or less addresses [these](https://github.com/microsoft/vscode-arduino/issues?utf8=%E2%9C%93&q=intellisense+is%3Aopen) issues (about seven).
4
-
5
-
It implements a parser which parses the output from Arduino's build process to generate a very precise `c_cpp_properties.json` which in turn hopefully renders any user interaction with this file obsolete
3
+
This branch more or less addresses the following issues:
4
+
| # | Issue | Title | Comment |
5
+
|--:|:------|:------------|:--------|
6
+
| 1|[#438](https://github.com/microsoft/vscode-arduino/issues/438)|**The Extension should automagically fill the c_cpp_properties.json, so intellisense works out of the box**| This is the issue to which I usually report news concerning the progress of this project |
7
+
| 2|[#876](https://github.com/microsoft/vscode-arduino/issues/876)|**Missing #define ARDUINO 10808 logic?**| Marked as bug but it's just the same problem again |
8
+
| 3|[#829](https://github.com/microsoft/vscode-arduino/issues/829)|**`Arduino.h` and ESP8266 includes have squiggles**| Stale issue |
9
+
| 4|[#969](https://github.com/microsoft/vscode-arduino/issues/969)|**INO Files defines undefined but can jump to definition**||
10
+
| 5|[#959](https://github.com/microsoft/vscode-arduino/issues/959)|**Update board type command does not update intellisense config automatically**||
| 7|[#850](https://github.com/microsoft/vscode-arduino/issues/850)|**How to prevent modifications of c_cpp_properties.json by the extension?**| Asks if the current implementation can be turned off, because it overwrites a user's config with non working IS config -- this is sad. |
13
+
| 8|[#833](https://github.com/microsoft/vscode-arduino/issues/833)|**Allow C_Cpp.intelliSenseEngine to be set to "Default" instead of "Tag Parser" for better code completion/suggestions**||
14
+
| 9|[#808](https://github.com/microsoft/vscode-arduino/issues/808)|**Identifier "Serial" is undefined**||
-- the list is probably incomplete - I didn't search exhaustively and didn't consider closed issues as long as I didn't stumble upon one. New duplicates are popping up at a rate of about one per week.
23
+
24
+
Further related issues
25
+
*[vscode-arduino issue search for IntelliSense](https://github.com/microsoft/vscode-arduino/issues?utf8=%E2%9C%93&q=intellisense+is%3Aopen)
26
+
*[Wrongly attributed to vscode instead of vscode-arduino](https://github.com/Microsoft/vscode-cpptools/issues/1750)
27
+
*[Problems with IntelliSense itself](https://github.com/microsoft/vscode-cpptools/issues/1034)
28
+
29
+
## Solution
30
+
Implement and add a a parser which parses the output from Arduino's build process and generate a very precise `c_cpp_properties.json` which in turn hopefully renders any user interaction with this file obsolete.
31
+
32
+
This mechanism should try it's best to detect situations in which the setup changes (board changed, sketch changed and so forth) and re-generate this configuration. For all other situations I'll provide a command to manually re-generate it.
6
33
7
34
## Branch Goals
8
35
### Build Output Parser
9
-
The parser which parses the relevant includes, defines, compiler paths and flags from Arduino's build output
36
+
The parser which identifies the main compilation command from Arduino's build output. It then parses the relevant includes, defines, compiler paths and flags from it.
37
+
10
38
### `c_cpp_properties.json` Generator
11
-
The generator takes the parser's output and transforms it into a valid `c_cpp_properties.json` file.
39
+
The generator takes the parser's output and transforms it into a valid `c_cpp_properties.json` file. It merges the generated configuration with the existing (e.g. user-) configurations and writes it back to the configuration file.
12
40
13
41
### Configuration Flags
14
-
Provide a configuration flag which allows the user to turn this feature off - this is useful for the cases in which this magic fails or the user has a very specific setup. Although this branch tries to eliminate most of the latter cases.
42
+
Provide a global configuration flag which allows the user to turn this feature off. A project- (sketch-) specific override will be provided which allows the user to turn it off or on - regardless of the global setting.
43
+
This is useful for the rare cases for which this magic should fail or the user has a very exotic setup. This branch tries to eliminate most of the latter cases though. Especially it will always write to the `Arduino` configuration. If the user sets up a custom configuration she/he must simply name it differently, e.g. `John's Custom Config`, and the generator won't touch it.
15
44
16
45
### Global Tasks in vscode-arduino
17
-
See table below.
46
+
* Integrate it into vscode-arduino's build mechanics
47
+
* Install event trigger generation/handling to run the analysis as soon as something changes
48
+
* Remove the current implementation
49
+
For more details see table below.
18
50
19
-
###Branch Log
51
+
## Branch Log
20
52
**2020 02 05** Currently I'm able to generate error free IntelliSense setups for AVR and ESP32 using the preliminary implementation. For ESP32 I just had to add the intrinsic compiler paths manually. A solution has to be found for these ... which there is, see [here](https://stackoverflow.com/a/6666338)
21
53
**2020 02 06** Got it fully working (with built-in include directories) for AVR, ESP32, ESP8266. Rewrote the backend to facilitate writing of further parser engines in the future.
22
54
**2020 02 07** Wrote compiler command parser npm package [cocopa](https://www.npmjs.com/package/cocopa) and began writing a test framework for it. Added a global configuration switch which allows the IntelliSense configuration generation to be turned off.
@@ -36,8 +68,9 @@ During merging I found some bugs within those functions - mainly due to the abov
36
68
* No consistent return values within `verify` (when it bailed out early it returned `void`)
37
69
38
70
**2020 02 17** Disabled and marked all previous implementations of IntelliSense support for later removal using `IS-REMOVE`. Pulled changes from upstream and merged them into the intellisense feature branch. Began to work on event handling/generation: vscode-arduino should detect when sketch/board/configuration and so on has changed, then re-analyze the current setup and set the IntelliSense configuration accordingly. This works more or less but there's a lot to fix in the current implementation which kept me busy till late today (I need some sleep now). Cleanup and commits follow tomorrow. Approaching alpha version for curious testers. OSX and Linux comes first, Windows will follow later.
71
+
**2020 02 18** Finished basic event triggering. Rewrote `DeviceContext` for proper settings modification detection (trigger events only on actual change) and generation of setting specific events (e.g. board changed) instead of one global event (aka. "something in the settings changed").
39
72
40
-
###Status
73
+
## Status
41
74
|| Tasks |
42
75
|-----:|:--------|
43
76
|**Build output parser**|:heavy_check_mark: Basic parser working |
@@ -58,15 +91,23 @@ During merging I found some bugs within those functions - mainly due to the abov
|**General**|:white_check_mark: Review and remove previous attempts messing with `c_cpp_properties.json` or IntelliSense. (Partially done - documented in the [General Tasks](#General-Tasks) section |
62
-
||:white_check_mark: Auto-run verify after a) *setting a board* b) *changing the sketch* c) *workbench initialized and no `c_cpp_properties.json` has been found*. We have to generate a valid `c_cpp_properties.json` to keep IntelliSense working in such situations. Identify other occasions where this applies (usually when adding new libraries), hint the user to run *Arduino: Rebuild IntelliSense Configuration*? -> Good moment would be after the workbench initialization -> message in arduino channel |
94
+
|**General**|:heavy_check_mark: Review and remove previous attempts messing with `c_cpp_properties.json` or IntelliSense (documented in the [General Tasks](#General-Tasks) section) `*`|
95
+
||:white_check_mark:*Auto-run verify when*|
96
+
|| :heavy_check_mark: a) setting a board `*`|
97
+
|| :heavy_check_mark: b) changing the board's configuration `*`|
98
+
|| :heavy_check_mark: c) changing the sketch `*`|
99
+
|| :white_check_mark: d) workbench initialized and no `c_cpp_properties.json` found |
100
+
|| :white_check_mark: e) Identify other occasions where this applies (usually when adding new libraries) |
101
+
||:white_check_mark: Hint the user to run *Arduino: Rebuild IntelliSense Configuration*? -> Good moment would be after the workbench initialization -> message in arduino channel |
102
+
||:white_check_mark: Better build management such that regular builds and analyze builds do not interfere |
103
+
||:white_check_mark: Analyze task queue which fits in the latter |
63
104
||:heavy_check_mark: Document configuration settings in [README.md](README.md)|
64
105
||:white_check_mark: Document features in [README.md](README.md) (partially done) |
65
106
||:heavy_check_mark: Try to auto-generate even if verify (i.e. compilation) fails |
66
-
||: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)|
107
+
||: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)|
67
108
||:heavy_check_mark: Parser only works when arduino is set to `verbose`, since this is the only way we get the compiler invocation command - this has to be fixed (done, see next item) |
68
109
||:heavy_check_mark: Implement a *Rebuild IntelliSense Configuration* command which runs verify verbosely internally and therefore allows us to find and parse the compiler command |
69
-
||:white_check_mark: Implement proper event generation for `DeviceContext`. a) Events should be issued only when something actually changes, b) Events should be issued for each setting separately |
110
+
||:heavy_check_mark: Implement proper event generation for `DeviceContext`. a) Events should be issued only when something actually changes, b) Events should be issued for each setting separately `*`|
70
111
||:white_check_mark: Finally: go through my code and look for TODOs |
71
112
72
113
`*` not committed to branch yet
@@ -80,8 +121,8 @@ I write a lot of code for Arduino, especially libraries. The Arduino IDE is not
80
121
81
122
Then remains vscode-arduino. It seems that it isn't completely dead - but almost. Most of the core functionality seems to work (I used it a few days now). But the biggest show stopper is the bad IntelliSense support -- which I'll address here now.
82
123
83
-
## Beer Money :beers:
84
-
You can chip in some beer money to keep me motivated - this is really appreciated.
124
+
## Beer Money :beers: -- Support
125
+
You can chip in some beer money to keep me motivated - this is *really* appreciated.
*[Debug logging for IntelliSense](https://code.visualstudio.com/docs/cpp/enable-logging-cpp)
160
+
*[Arduino Dev Tools](https://playground.arduino.cc/Main/DevelopmentTools/) (obsolete/outdated)
124
161
125
162
## Future Work
126
163
* Proper interactive serial terminal (this is the second major show stopper in my opinion)
@@ -244,15 +281,11 @@ Sometimes IntelliSense has problems within the extension host (which you're runn
244
281
245
282
----
246
283
247
-
## Implementation
248
-
**Note** Check this vscode feature:
249
-
```
250
-
Configuration provider
251
-
The ID of a VS Code extension that can provide IntelliSense configuration information for source files. For example, use the VS Code extension ID ms-vscode.cmake-tools to provide configuration information from the CMake Tools extension.
252
-
```
284
+
# Implementation
285
+
Here are some implementation notes. Probably only of interest to me.
253
286
254
-
###Build Output Parser
255
-
####Intrinsic Include Paths
287
+
## Build Output Parser
288
+
### Intrinsic Include Paths
256
289
Some include paths are built into gcc and don't have to be specified on the command line. Just searching the compiler installation directory with something like
0 commit comments