-
-
Notifications
You must be signed in to change notification settings - Fork 436
#118, #1154 Link compiler errors to editor. #1275
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe the problem
On my Windows machine, clicking the "Reveal Error" link or using the Ctrl+click shortcut does not result in the cursor moving to the file and line specified in the error message.
To reproduce
- Compile a sketch that will produce an error:
ⓘ I provided a short sketch that will produce two errors to keep the demo simple, but I also have the same problem with smaller and larger multi-file sketches.
void setup() { someerror } void loop() { anothererror }
- Hover the mouse pointer above one of the underlined links in the output:
C:\Users\per\Documents\Arduino\Error\Error.ino: In function 'void loop()': C:\Users\per\Documents\Arduino\Error\Error.ino:5:3: error: 'anothererror' was not declared in this scope anothererror ^~~~~~~~~~~~ C:\Users\per\Documents\Arduino\Error\Error.ino:5:3: note: suggested alternative: 'strerror' anothererror ^~~~~~~~~~~~ strerror
- Click the "Reveal Error" link.
🐛 The cursor is not moved to the line of the sketch associated with the error message.
Expected behavior
Cursor is moved to the line of the sketch associated with the error message after clicking the "Reveal Error" link or doing a Ctrl+click.
Arduino IDE version
2.0.0-rc9-snapshot-0c9e1ab
Operating system
Windows
Operating system version
10
Additional context
It works fine on my Linux machine but I have not been able to get the link to work even once on my Windows machine after trying various sketches.
I see the following logs in the Developer Tools console after clicking the "Reveal Error" link:
logger-protocol.ts:110 root INFO compiler-errors Current error changed to c;58
logger-protocol.ts:110 root INFO compiler-errors Handling selection change in editor file:///c%3A/Users/per/Documents/Arduino/Error/Error.ino. New (monaco) selection: [2,3 -> 2,3]
logger-protocol.ts:110 root WARN compiler-errors Failed to mark error c;59 as the current one. Error is unknown. Known errors are: c;58,c;59
e.log @ logger-protocol.ts:110
(anonymous) @ logger-frontend-module.ts:41
(anonymous) @ logger.ts:312
(anonymous) @ logger.ts:304
Promise.then (async)
log @ logger.ts:299
i @ logger.ts:45
markAsCurrentError @ compiler-errors.ts:655
execute @ compiler-errors.ts:267
executeCommand @ command.ts:336
async function (async)
executeCommand @ command.ts:335
open @ command-open-handler.ts:50
t.open @ opener-service.ts:90
async function (async)
t.open @ opener-service.ts:89
interceptOpen @ monaco-editor-provider.ts:208
open @ monaco-editor-provider.ts:153
(anonymous) @ openerService.ts:173
(anonymous) @ markerDecorations.ts:26
r @ markerDecorations.ts:26
open @ openerService.ts:160
callback @ markdownRenderer.ts:100
(anonymous) @ markdownRenderer.ts:206
(anonymous) @ event.ts:128
invoke @ event.ts:569
fire @ event.ts:736
o @ event.ts:37
I do not see this "Failed to mark error" line in the console on my Linux machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe the problem
Scrolling the output view up at the end of the compilation can cause the link to be placed on the wrong line.
This is fairly minor and is likely to be rarely produced by the user. I did encounter it purely by chance on the first test on my Linux machine, so thought it was at least worth mentioning, but I don't think it is worth spending a lot of time on if it is challenging.
To reproduce
- Select File > Preferences... from the Arduino IDE menus.
- Check the box next to Show verbose output during > ☐ compile.
- Click the OK button.
- Compile a sketch that will produce an error:
void setup() { someerror } void loop() {}
- As soon as the compilation process finishes, scroll the output view up to the top.
🐛 If the timing was correct, one of the lines of the compilation commands will be linked instead of the expected error message line:
Expected behavior
The link is placed on the error message.
Arduino IDE version
2.0.0-rc9-snapshot-0c9e1ab
Operating system
Ubuntu 20.04
Additional context
I have not been able to produce this on my Windows machine.
I notice that the compilation command stdout lines are mixed up with the stderr lines, while on my Windows machine all the stdout is printed before the start of the stderr. So perhaps this is the explanation for the different results between the two machines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe the problem
When a sketch file contains multiple error highlights, the selection is lost at each highlighted line while selecting in an upward direction.
To reproduce
- Compile a sketch that will produce errors on multiple lines of a single file:
void setup() { fooError } void loop() { barError }
- Wait for the compilation process to fail, as expected.
- Click at the bottom area of the editor view and drag the mouse pointer upwards to select the sketch code.
🐛 The selection is lost as the mouse pointer crosses each of the highlighted lines:
Expected behavior
Selecting sketch code text is not affected by the error line highlights.
Arduino IDE version
2.0.0-rc9-snapshot-0c9e1ab
Operating system
Windows 10, Ubuntu 20.04
Additional context
The issue also occurs when selecting via the Shift+↑ keyboard shortcut.
The issue does not occur when selecting by click and drag in a downwards direction.
The issue does not occur when selecting via the Ctrl+Shift+Home keyboard shortcut.
I notice that multiple error lines are now highlighted, whereas with previous versions of the Arduino IDE (going all the way back to the introduction of the feature at 4611381), only a single line was highlighted unless the arduino.compile.experimental
advanced setting was enabled. Since the issue only occurs when there are multiple highlights, I thought this observation it was worth mentioning.
For some reason, the error highlight at line 5 does not appear in the screencast above, even though I can see it on my monitor:
For the record, it's unrelated to scrolling. The output content is not the same as the content parsed for errors. Parsed content:
Content printed to Output:
The important part is the location of the Note, the Output contains more information than the parsed output. It's normal and expected:
Here is the list of sent (by Theia backend) and received (by Theia frontend, Output view) messages:
|
2886582
to
dad09c5
Compare
It should be fixed now.
It was unrelated to the scrolling, but it should work correctly now.
This change is required to support all error links from the output, not only one 😬 . I can add the technical explanation on why if required. @per1234, do you prefer to show only one error (highlighted with the "red" line) even if there are multiple errors? It's not a trivial task but probably doable. Thank you!
I could not reproduce it on both macOS and Windows so far. |
I still could not reproduce it. Per, if you have some time, please give the updated version a try. I still see some issues when deleting content from the editor, the markers are not removed correctly. I try to find a solution and/or document the known issues. Upstream: microsoft/monaco-editor#2138 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problems I reported in my previous review are now resolved and everything is working perfectly for me.
This is sure to greatly enhance the user experience when developing larger sketches.
Thanks Akos!
I can reproduce it consistently on both Windows and Linux when using 2.0.0-rc9-snapshot-0c9e1ab (the build from fef76f2). I can not reproduce it when using the build from 5b6580c, so it must have been fixed inadvertently by some of the changes you made between those revisions.
I don't have a strong preference either way. I only mentioned the change because it seemed possibly related to the lost selection bug. |
Motivation
Can reveal the error location in the editor from the Output view.
Change description
In-action:
link-error.mp4
Noteworthy changes:
TextDocumentChangeEvent
affects the line where the decorator is.remove-decorator-when-line-changed.mp4
Other information
Closes #118
Closes #1154
Reviewer checklist