UI unresponsive when sketch has a very long line #1343
Labels
conclusion: resolved
Issue was resolved
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Describe the problem
Arduino sketches may contain large machine generated arrays for data such as images. These may span many columns, using a block that follows the dimensions of the source data (e.g., an array with 320 elements per line might be generated for a 320x240 pixel image), or even be all on a single long line.
🐛 The Arduino IDE UI becomes noticeably laggy or even completely unresponsive when the sketch contains a long line
To reproduce
LongLine.zip
🐛 The IDE UI is completely unresponsive.
editor.maxTokenizationLineLength
20000
to500
🙂 The IDE remains perfectly responsive.
Expected behavior
IDE is usable when the sketch contains long lines.
Arduino IDE version
2.0.0-rc9.2.snapshot-de32bdd
Operating system
Windows
Operating system version
10
Additional context
I am able reproduce the issue in Theia Blueprint (but not in VS Code), so the inability to handle such content is not a bug in the Arduino IDE codebase.
I see that this was reported in the Theia project and fixed by reducing the default value of the
editor.maxTokenizationLineLength
to 400: eclipse-theia/theia#8021So a similar change should be made in Arduino IDE as well.
I used a ridiculously long line in the demo sketch (though it was generated from an image of only 32x32 px, using an established tool). More reasonable line lengths result in less dramatic impact, but still make the IDE unpleasant to use. A real world file was provided here:
https://forum.arduino.cc/t/2-0-slows-down-if-very-long-lines-but-ok-with-crs-line-feeds-inserted/1021335/5
It seems that changes to the
editor.maxTokenizationLineLength
setting are not applied to sketches which have already been "tokenized", so make sure to reload the sketch if you are experimenting with the setting.The issue is not related to the Arduino Language Server because it occurs even when the language server is not running due to not having a board open.
Originally reported at https://forum.arduino.cc/t/2-0-slows-down-if-very-long-lines-but-ok-with-crs-line-feeds-inserted/1021335
Issue checklist
The text was updated successfully, but these errors were encountered: