Skip to content

Incorrect error line highlight when error is inside folded code #8457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
per1234 opened this issue Jan 28, 2019 · 2 comments
Closed

Incorrect error line highlight when error is inside folded code #8457

per1234 opened this issue Jan 28, 2019 · 2 comments
Labels
Component: IDE user interface The Arduino IDE's user interface Type: Bug

Comments

@per1234
Copy link
Collaborator

per1234 commented Jan 28, 2019

Using Arduino IDE 1.8.9 Hourly Build 2019/01/24 07:33 and Arduino IDE 1.9.0-beta build 100 with Windows 10 64 bit

  1. Create the following sketch in the Arduino IDE:
    void setup() {}
    void loop() {
      #error
    }
  2. File > Preferences > Enable Code Folding (check) > OK
  3. Click the [-] icon to the left of the line:
    void loop() {
  4. Sketch > Verify/Compile

The first line of the sketch will be highlighted in pink, incorrectly indicating the error is there.

Suggested improvements on this behavior:

  • Unfold the code section with the error and place the highlight on the correct line.
  • Don't do an error highlight when it cannot be correctly placed. The user can always get the line number from the error message in the console.
  • Place error highlight at the start of the fold. This is still slightly confusing, but it's more intuitive than the current behavior.
  • Unfold all on error. This seems like it could be annoying to the user so it might just be trading a new issue for an old one.

I have a suspicion this is a limitation of rSyntaxTextArea rather than the Arduino IDE, but I'm not certain of it, so I thought it was worth reporting here.

Originally reported: http://forum.arduino.cc/index.php?topic=443558.msg4036044#msg4036044

@facchinm
Copy link
Member

I remember we had a similar issue in the past and the solution was to unfold all the code before highlighting the line. It was surely related with rSyntaxTextArea not behaving properly but I have to check in the past issues to make sure it's not a regression

@facchinm
Copy link
Member

facchinm commented Jan 28, 2019

Found it, it was not totally related but probably the fix is the same
b5223cc

facchinm added a commit to facchinm/Arduino that referenced this issue Jan 28, 2019
Fixes arduino#8457

For some reason, getCurrentTab().getTextArea().getFoldManager().ensureOffsetNotInClosedFold(line) doesn't work here; there no documentation on what offset is.
Also, getFoldForLine(line) returns null even if the line is folded (bug in rsyntaxtextarea?)
@facchinm facchinm added Component: IDE user interface The Arduino IDE's user interface Type: Bug labels Jan 28, 2019
facchinm added a commit to facchinm/Arduino that referenced this issue Mar 7, 2019
Fixes arduino#8457

For some reason, getCurrentTab().getTextArea().getFoldManager().ensureOffsetNotInClosedFold(line) doesn't work here; there no documentation on what offset is.
Also, getFoldForLine(line) returns null even if the line is folded (bug in rsyntaxtextarea?)
facchinm added a commit that referenced this issue Mar 7, 2019
Fixes #8457

For some reason, getCurrentTab().getTextArea().getFoldManager().ensureOffsetNotInClosedFold(line) doesn't work here; there no documentation on what offset is.
Also, getFoldForLine(line) returns null even if the line is folded (bug in rsyntaxtextarea?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE user interface The Arduino IDE's user interface Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants