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

Commit cabeed6

Browse files
elektronikworkshopadiazulay
authored andcommitted
Updated log and issues
* Added/documented all known related issues * Updated log * Updated and extended status * General brushing of structure and text
1 parent d6c7b5a commit cabeed6

File tree

1 file changed

+79
-39
lines changed

1 file changed

+79
-39
lines changed

BRANCHNOTES.md

+79-39
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,54 @@
11
# IntelliSense Autoconfiguration Branch
22
## 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** | |
11+
| 6| [#892](https://github.com/microsoft/vscode-arduino/issues/892) | **Default IntelliSense config** | |
12+
| 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** | |
15+
| 10| [#474](https://github.com/microsoft/vscode-arduino/issues/474) | **Enrich device develop experience** | |
16+
17+
<!-- | 11| [#](https://github.com/microsoft/vscode-arduino/issues/) | | | -->
18+
<!-- | 12| [#](https://github.com/microsoft/vscode-arduino/issues/) | | | -->
19+
<!-- | 13| [#](https://github.com/microsoft/vscode-arduino/issues/) | | | -->
20+
<!-- | 14| [#](https://github.com/microsoft/vscode-arduino/issues/) | | | -->
21+
22+
-- 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.
633

734
## Branch Goals
835
### 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+
1038
### `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.
1240

1341
### 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.
1544

1645
### 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.
1850

19-
### Branch Log
51+
## Branch Log
2052
**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)
2153
**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.
2254
**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
3668
* No consistent return values within `verify` (when it bailed out early it returned `void`)
3769

3870
**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").
3972

40-
### Status
73+
## Status
4174
| | Tasks |
4275
|-----:|:--------|
4376
| **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
5891
| **Unit tests** | :heavy_check_mark: Basic parser (known boards, match/no match)|
5992
| | :white_check_mark: All unit tests in cocopa |
6093
| | :white_check_mark: Test with cpp sketches |
61-
| **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+
| | &nbsp;&nbsp;&nbsp;&nbsp;:heavy_check_mark: a) setting a board `*` |
97+
| | &nbsp;&nbsp;&nbsp;&nbsp;:heavy_check_mark: b) changing the board's configuration `*` |
98+
| | &nbsp;&nbsp;&nbsp;&nbsp;:heavy_check_mark: c) changing the sketch `*` |
99+
| | &nbsp;&nbsp;&nbsp;&nbsp;:white_check_mark: d) workbench initialized and no `c_cpp_properties.json` found |
100+
| | &nbsp;&nbsp;&nbsp;&nbsp;: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 |
63104
| | :heavy_check_mark: Document configuration settings in [README.md](README.md) |
64105
| | :white_check_mark: Document features in [README.md](README.md) (partially done) |
65106
| | :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) |
67108
| | :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) |
68109
| | :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 `*`|
70111
| | :white_check_mark: Finally: go through my code and look for TODOs |
71112

72113
`*` not committed to branch yet
@@ -80,8 +121,8 @@ I write a lot of code for Arduino, especially libraries. The Arduino IDE is not
80121

81122
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.
82123

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.
85126

86127
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PVLCSRZHBJ28G&source=url)
87128

@@ -103,24 +144,20 @@ I will list every supporter here, thanks!
103144
2020-02-15 T.D.: 4 :beers: (20$ - Thanks a lot!)
104145
2020-02-15 Elektronik Workshop: 28 :beers: (7h coding)
105146
2020-02-17 Elektronik Workshop: 52 :beers: (13h coding)
147+
2020-02-18 Elektronik Workshop: xx :beers: (xxh coding)
106148

107149
<!-- https://github.com/StylishThemes/GitHub-Dark/wiki/Emoji -->
108150

109151
## Useful Links
110-
* [IntelliSense issues on vscode-arduino](https://github.com/microsoft/vscode-arduino/issues?utf8=%E2%9C%93&q=intellisense+is%3Aopen)
111152
* [`c_cpp_properties.json` reference](https://code.visualstudio.com/docs/cpp/c-cpp-properties-schema-reference)
112153
* [Interactive regex debugger](https://regex101.com/)
113154
* [Git branch management](https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/)
114155
* [Collapsible Markdown](https://gist.githubusercontent.com/joyrexus/16041f2426450e73f5df9391f7f7ae5f/raw/f774f242feff6bae4a5be7d6c71aa5df2e3fcb0e/README.md)
115156
* [Arduino CLI manpage](https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc)
116157
* [Install extensions from file](https://vscode-docs.readthedocs.io/en/stable/extensions/install-extension/)
117-
* [Publish extensions](https://code.visualstudio.com/api/working-with-extensions/publishing-extension)
118-
* [Arduino Dev Tools](https://playground.arduino.cc/Main/DevelopmentTools/)
119-
120-
## Issues Concerning this Project
121-
* https://github.com/Microsoft/vscode-cpptools/issues/1750
122-
* Problems with IntelliSense itself https://github.com/microsoft/vscode-cpptools/issues/1034
123-
* Logging for IntelliSense https://code.visualstudio.com/docs/cpp/enable-logging-cpp
158+
* [Publish vscode extensions](https://code.visualstudio.com/api/working-with-extensions/publishing-extension)
159+
* [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)
124161

125162
## Future Work
126163
* 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
244281

245282
----
246283

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.
253286

254-
### Build Output Parser
255-
#### Intrinsic Include Paths
287+
## Build Output Parser
288+
### Intrinsic Include Paths
256289
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
257290
```bash
258291
find ~/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/ -name "include*"
@@ -294,11 +327,11 @@ End of search list.
294327
```
295328
As one can see with the ESP32-gcc not all include directories are named `include`. Parsing of this output is pretty trivial though.
296329

297-
### `c_cpp_properties.json` Generator
330+
## `c_cpp_properties.json` Generator
298331

299332

300-
### Settings
301-
#### Global Settings
333+
## Settings
334+
### Global Settings
302335
Under linux at `~/.config/Code/User/settings.json`, for instance:
303336
```json
304337
{
@@ -312,7 +345,7 @@ Code: [src/arduino/arduinoSettings.ts](src/arduino/arduinoSettings.ts)
312345
Code: [src/arduino/vscodeSettings.ts](src/arduino/vscodeSettings.ts)
313346
Validator: [package.json](package.json)
314347

315-
#### Project Settings
348+
### Project Settings
316349
Path in project `.vscode/arduino.json`
317350
```json
318351
{
@@ -325,8 +358,8 @@ Path in project `.vscode/arduino.json`
325358
Code: [src/deviceContext.ts](src/deviceContext.ts)
326359
Validator: [misc/arduinoValidator.json](misc/arduinoValidator.json)
327360

328-
### General Tasks
329-
#### Removing existing Attempts which mess with c_cpp_properties.json or Intellisense
361+
## General Tasks
362+
### Removing existing Attempts which mess with c_cpp_properties.json or Intellisense
330363

331364
Remove these as they are helpless attempts to get IntelliSense working:
332365
```ts
@@ -344,7 +377,14 @@ Remove these as they are helpless attempts to get IntelliSense working:
344377
Remove this as this messes in an unpredictable and helpless way with Intellisense
345378
[src/langService/completionProvider.ts](src/langService/completionProvider.ts)
346379

347-
Remove this folder as this is not necessary when Intellisense works properly:
380+
Review this folder as some of this is probably obsolete when Intellisense works properly:
348381
```
349-
syntaxes/
382+
syntaxes/arduino.configuration.json
383+
syntaxes/arduino.tmLanguage
384+
# Within package.json
385+
{
386+
"language": "cpp",
387+
"path": "./syntaxes/arduino.tmLanguage",
388+
"scopeName": "source.cpp.arduino"
389+
},
350390
```

0 commit comments

Comments
 (0)