Closed
Description
Describe the problem
Right clicking on the sketch editor view opens a context menu that offers various useful operations that can be done on the selection:
🐛 The "Refactor..." and "Source Action..." context menu items don't appear to be usable with Arduino sketches. They increase the complexity and clutter of the Arduino IDE user interface without adding anything of value.
To reproduce
- Select any code in the sketch editor view.
- Right click on the selection.
- Select "Refactor..." from the context menu.
😕 A tooltip appears: "No refactorings available" - Right click on the selection.
- Select "Source Action..." from the context menu.
😕 A tooltip appears: "No source actions available"
Expected behavior
All items in the editor context menu are useful.
Arduino IDE version
2.0.0-rc9.2.snapshot-20cc34c
Operating system
Windows, Linux
Operating system version
Windows 10, Ubuntu 20.04
Additional context
Additional Reports
- chore: Theia 1.37.0 #2027 (review)
- https://forum.arduino.cc/t/arduino-ide-refactoring-does-not-work-macos/1063461 / https://forum.arduino.cc/t/outils-du-menu-contextuel-dans-lediteur/1063025
- https://forum.arduino.cc/t/refactoring-still-not-working/1036055
- https://forum.arduino.cc/t/code-navigation/1033135/3
Issue checklist
- I searched for previous reports in the issue trackerI verified the problem still occurs when using the latest nightly buildMy report contains all necessary details
Activity
kittaakos commentedon Sep 5, 2022
The LS should use them. Instead of removing the context menu items, I recommend supporting them in IDE2 in the long run.
Update: if we remove them, we need to decide whether to remove them for
.ino
files or all over the application. (Related: #1395 (comment)) Thank you!per1234 commentedon Sep 5, 2022
The question is: how difficult will it be to support them, and how long will it take to add that? If it will be a long time and the context menu customization is easy to do, I think it would be worth removing them provisionally.
I would remove them anywhere they are not working.
I also don't think it is worth making any effort or using system resources to provide enhanced functionalities for JSON (though I would make an exception for the
settings.json
schema). Only a tiny fraction of users will want to directly edit JSON files in the IDE. If they need enhanced JSON capabilities, they can use any of the many existing tools that provide it.kittaakos commentedon Sep 6, 2022
IDE2 does not know it upfront. If a language (
json
,ino
) is contributed to IDE2, the capabilities come from the server the menu items will be there. IDE2 has no chance to figure out if the capabilities are functional or not.I think the problem is here. The Arduino LS remaps the code actions from clangd as they are, but the Arduino LS's id is not
clangd
, but the language ID isino
so the quick fixes, refactorings won't work.Customizing these menus is not trivial either. I propose sticking to the natural workflow and fixing the real issue instead of trying to remove the menu items as part of a hack.
per1234 commentedon Sep 6, 2022
@ubidefeo, since this was originally your issue (9890 in the internal backlog), what do you think? Should we close this in favor of a bug report in
arduino/arduino-language-reference
tracking the defect that causes these context menu items to be non-functional?[-]Non-functional items in editor context menu[/-][+]Non-functional language server items in editor context menu[/+]berparis commentedon Dec 12, 2022
Hello,
I don't understand what exact status now is that bug report, but it would be very usefull to have this feature working.
I'm using Arduino IDE 2.0.3 with MacOS Ventura 13.0.1 and I observe exactly the described problem here on top of page.
Thanks, Bernard
fix: removed undesired editor context menu items
chore: updated to Theia `1.37.0`
chore: updated to Theia `1.37.0`