Unsaved changes cause wrong error display in output window after compilation. #2542
Open
3 tasks done
Labels
type: imperfection
Perceived defect in any part of project
Describe the problem
The line number containing the error is correct, the ~~~~~ underline indicating the error position is also correct, but the line contents is read from disk and thus it is wrong unless sketch was just saved.
The workaround for the moment is to always save before compile or keep AutoSave enabled.
This is obviously a non-critical bug, but it shouldn't be too hard to fix either.
The sketch in memory is used to show the correct line number and the exact line position of the error, just use that instead of re-reading the lines from disk.
To reproduce
Disable Autosave in settings, make a deliberate error and reorder something (e.g. a function) so that error is now on a different line.
Compile without saving the sketch.
In the output window the error will be shown with the correct (new) line number and the exact character position will be indicated, but the line contents will be that of the sketch on disk.
Expected behavior
The correct line number, with the correct line contents and line position of the error should be shown.
Arduino IDE version
2.3.2
Operating system
Windows
Operating system version
Windows 10 22H2
Additional context
I wasn't able to verify with the latest nightly build because it seems to get stuck at 60% "Downloading index: package_esp9266com_index.json" during startup.
Issue checklist
The text was updated successfully, but these errors were encountered: