Description
Describe the problem
The features that rely on the language server (autocomplete, editor hover, "Go To Definition", "Go To Symbol", "Peek Definition") don't work when a board from the Arduino "megaAVR" architecture (megaAVR 0-series, tinyAVR 0-series and 1-series) (e.g., Nano Every, Uno WiFi Rev2) is selected.
To reproduce
- Use the Arduino IDE "Boards Manager" to install the "Arduino megaAVR Boards" platform, if not already installed.
- Select File > New from the Arduino IDE menus.
- Select Tools > Board > Arduino megaAVR Boards > Nano Every from the Arduino IDE menus.
- Hover the mouse pointer over
setup
in the sketch code code
🐛 No "hover" popup appears. - Right click on
setup()
- Select "Go To Definition" from the context menu.
🐛 A "No definition found for 'setup'" tooltip appears. - Right click on
setup()
- Select "Go To Symbol" from the context menu.
🐛 The command palette shows "No editor symbols" - Right click on
setup()
- Select "Peek > Peek Definition" from the context menu.
🐛 A "No definition found for 'setup'" tooltip appears. - Type the following code inside the
setup
function:pinMo
- Press Ctrl+Space
🐛 The "suggest" interface shows "No suggestions."
Expected behavior
Language server features to work on megaAVR boards just like on boards of other architectures.
Arduino IDE version
Original report
2.0.0-beta.2-snapshot.f9730ab
Last verified with
2.0.0-rc9.3
Operating system
Windows, Linux
Operating system version
Windows 10, Ubuntu 20.04
Additional context
From inols-clangd-err.log
:
V[12:54:19.163] Ignored diagnostic. unknown target CPU 'atmega4809'
V[12:54:19.163] Ignored diagnostic. valid target CPU values are: avr1, avr2, avr25, avr3, avr31, avr35, avr4, avr5, avr51, avr6, avrxmega1, avrxmega2, avrxmega3, avrxmega4, avrxmega5, avrxmega6, avrxmega7, avrtiny, at90s1200, attiny11, attiny12, attiny15, attiny28, at90s2313, at90s2323, at90s2333, at90s2343, attiny22, attiny26, at86rf401, at90s4414, at90s4433, at90s4434, at90s8515, at90c8534, at90s8535, ata5272, attiny13, attiny13a, attiny2313, attiny2313a, attiny24, attiny24a, attiny4313, attiny44, attiny44a, attiny84, attiny84a, attiny25, attiny45, attiny85, attiny261, attiny261a, attiny441, attiny461, attiny461a, attiny841, attiny861, attiny861a, attiny87, attiny43u, attiny48, attiny88, attiny828, at43usb355, at76c711, atmega103, at43usb320, attiny167, at90usb82, at90usb162, ata5505, atmega8u2, atmega16u2, atmega32u2, attiny1634, atmega8, ata6289, atmega8a, ata6285, ata6286, atmega48, atmega48a, atmega48pa, atmega48pb, atmega48p, atmega88, atmega88a, atmega88p, atmega88pa, atmega88pb, atmega8515, atmega8535, atmega8hva, at90pwm1, at90pwm2, at90pwm2b, at90pwm3, at90pwm3b, at90pwm81, ata5790, ata5795, atmega16, atmega16a, atmega161, atmega162, atmega163, atmega164a, atmega164p, atmega164pa, atmega165, atmega165a, atmega165p, atmega165pa, atmega168, atmega168a, atmega168p, atmega168pa, atmega168pb, atmega169, atmega169a, atmega169p, atmega169pa, atmega32, atmega32a, atmega323, atmega324a, atmega324p, atmega324pa, atmega324pb, atmega325, atmega325a, atmega325p, atmega325pa, atmega3250, atmega3250a, atmega3250p, atmega3250pa, atmega328, atmega328p, atmega328pb, atmega329, atmega329a, atmega329p, atmega329pa, atmega3290, atmega3290a, atmega3290p, atmega3290pa, atmega406, atmega64, atmega64a, atmega640, atmega644, atmega644a, atmega644p, atmega644pa, atmega645, atmega645a, atmega645p, atmega649, atmega649a, atmega649p, atmega6450, atmega6450a, atmega6450p, atmega6490, atmega6490a, atmega6490p, atmega64rfr2, atmega644rfr2, atmega16hva, atmega16hva2, atmega16hvb, atmega16hvbrevb, atmega32hvb, atmega32hvbrevb, atmega64hve, at90can32, at90can64, at90pwm161, at90pwm216, at90pwm316, atmega32c1, atmega64c1, atmega16m1, atmega32m1, atmega64m1, atmega16u4, atmega32u4, atmega32u6, at90usb646, at90usb647, at90scr100, at94k, m3000, atmega128, atmega128a, atmega1280, atmega1281, atmega1284, atmega1284p, atmega128rfa1, atmega128rfr2, atmega1284rfr2, at90can128, at90usb1286, at90usb1287, atmega2560, atmega2561, atmega256rfr2, atmega2564rfr2, atxmega16a4, atxmega16a4u, atxmega16c4, atxmega16d4, atxmega32a4, atxmega32a4u, atxmega32c4, atxmega32d4, atxmega32e5, atxmega16e5, atxmega8e5, atxmega32x1, atxmega64a3, atxmega64a3u, atxmega64a4u, atxmega64b1, atxmega64b3, atxmega64c3, atxmega64d3, atxmega64d4, atxmega64a1, atxmega64a1u, atxmega128a3, atxmega128a3u, atxmega128b1, atxmega128b3, atxmega128c3, atxmega128d3, atxmega128d4, atxmega192a3, atxmega192a3u, atxmega192c3, atxmega192d3, atxmega256a3, atxmega256a3u, atxmega256a3b, atxmega256a3bu, atxmega256c3, atxmega256d3, atxmega384c3, atxmega384d3, atxmega128a1, atxmega128a1u, atxmega128a4u, attiny4, attiny5, attiny9, attiny10, attiny20, attiny40, attiny102, attiny104
E[12:54:19.163] Indexing C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.7\cores\arduino\WInterrupts.cpp failed: Couldn't build compiler instance
The equivalent error occurs when using boards with other microcontrollers in this architecture family.
This is actually a deficiency in lower level tools (clangd via Arduino Language Server), and not actually anything to do with the Arduino IDE 2.x code base. So in fact the issue is off topic for this repository, but it was decided that an issue should be created here for the sake of documenting it in a place that would be easily found by Arduino IDE 2.x users.
The deficiency is also tracked in the Arduino Language Server repository at arduino/arduino-language-server#112
Updates
- tinyAVR 0-series and 1-series was added by llvm/llvm-project@b0d4d96
- Arduino IDE was updated to use the clangd version with support via a59e0da
- megaAVR 0-series support appears to have been added to clangd, released in LLVM 15.0.0: llvm/llvm-project@b62ea9b
- Arduino IDE has not yet been updated to use the clangd version with support.
Additional reports
- https://forum.arduino.cc/t/ide-2-0-3-editor-discover-like-feature-name-and-usage-questions/1072796
- https://forum.arduino.cc/t/windows-10-suggestions-dont-work/1071229
- https://forum.arduino.cc/t/go-to-definition-not-working/1020673
- https://forum.arduino.cc/t/known-bug-arduino-ide-2-0-different-rcs-autocomplete-not-working-for-specific-targets/1007394
- https://forum.arduino.cc/t/where-to-locate-h-files-in-ide-2/1138746/9
- https://forum.arduino.cc/t/intellisense-autocomplete-problems-and-other-things-i-miss/698272
- https://forum.arduino.cc/t/intellisense-in-ide-20-beta-solved/847876/3
- https://forum.arduino.cc/t/force-update-of-function-definitions/1202908
- https://forum.arduino.cc/t/hover-information-not-working/1181315/9
- https://forum.arduino.cc/t/ide-2-3-4-hover-not-working/1358681
- https://forum.arduino.cc/t/go-to-file-under-cursor/1361086