Skip to content
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

#118, #1154 Link compiler errors to editor. #1275

Merged
merged 2 commits into from
Aug 15, 2022
Merged

#118, #1154 Link compiler errors to editor. #1275

merged 2 commits into from
Aug 15, 2022

Conversation

kittaakos
Copy link
Contributor

@kittaakos kittaakos commented Aug 2, 2022

Motivation

Can reveal the error location in the editor from the Output view.

Change description

In-action:

link-error.mp4

Noteworthy changes:

  • The error decoration is automatically removed from the editor when a TextDocumentChangeEvent affects the line where the decorator is.
remove-decorator-when-line-changed.mp4

Other information

Closes #118
Closes #1154

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

@kittaakos kittaakos marked this pull request as ready for review August 2, 2022 12:43
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Aug 3, 2022
Copy link
Contributor

@per1234 per1234 left a 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

  1. Compile a sketch that will produce an error:
    void setup() {
      someerror
    }
    void loop() {
      anothererror
    }
    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.
  2. 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
    
  3. 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.

Copy link
Contributor

@per1234 per1234 left a 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

  1. Select File > Preferences... from the Arduino IDE menus.
  2. Check the box next to Show verbose output during > ☐ compile.
  3. Click the OK button.
  4. Compile a sketch that will produce an error:
    void setup() {
      someerror
    }
    void loop() {}
  5. 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:

image

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?

Copy link
Contributor

@per1234 per1234 left a 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

  1. Compile a sketch that will produce errors on multiple lines of a single file:
    void setup() {
      fooError
    }
    void loop() {
      barError
    }
  2. Wait for the compilation process to fail, as expected.
  3. 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:

sm-focus

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:

image

@kittaakos kittaakos added the status: on hold Do not proceed at this time label Aug 4, 2022
@per1234 per1234 mentioned this pull request Aug 6, 2022
3 tasks
@kittaakos
Copy link
Contributor Author

kittaakos commented Aug 10, 2022

Scrolling the output view up at the end of the compilation can cause the link to be placed on the wrong line.

For the record, it's unrelated to scrolling. The output content is not the same as the content parsed for errors.

Parsed content:

Using board 'uno' from platform in folder: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
Using core 'arduino' from platform in folder: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
Detecting libraries used...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /dev/null
Generating function prototypes...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/preproc/ctags_target_for_gcc_minus_e.cpp
/Users/a.kitta/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp.o
/Users/a.kitta/Documents/Arduino/min/min.ino: In function 'void setup()':
/Users/a.kitta/Documents/Arduino/min/min.ino:2:3: error: 'someerror' was not declared in this scope
   someerror
   ^~~~~~~~~
/Users/a.kitta/Documents/Arduino/min/min.ino:2:3: note: suggested alternative: 'strerror'
   someerror
   ^~~~~~~~~
   strerror


Content printed to Output:

Using board 'uno' from platform in folder: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
Using core 'arduino' from platform in folder: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
Detecting libraries used...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /dev/null
Generating function prototypes...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/preproc/ctags_target_for_gcc_minus_e.cpp
/Users/a.kitta/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/preproc/ctags_target_for_gcc_minus_e.cpp
/Users/a.kitta/Documents/Arduino/min/min.ino: In function 'void setup()':
/Users/a.kitta/Documents/Arduino/min/min.ino:2:3: error: 'someerror' was not declared in this scope
   someerror
   ^~~~~~~~~
Compiling sketch...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp.o
/Users/a.kitta/Documents/Arduino/min/min.ino:2:3: note: suggested alternative: 'strerror'
   someerror
   ^~~~~~~~~
   strerror

exit status 1

Compilation error: 'someerror' was not declared in this scope

The important part is the location of the Compiling sketch....

Note, the Output contains more information than the parsed output. It's normal and expected:

exit status 1

Compilation error: 'someerror' was not declared in this scope

Here is the list of sent (by Theia backend) and received (by Theia frontend, Output view) messages:

root INFO compile-response, SEND 2022-08-10T14:40:48.177Z 2 Using board 'uno' from platform in folder: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
Using core 'arduino' from platform in folder: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
root INFO compile-response, RECEIVED 2022-08-10T14:40:48.178Z 2 Using board 'uno' from platform in folder: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
Using core 'arduino' from platform in folder: /Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
root INFO compile-response, SEND 2022-08-10T14:40:48.343Z 2 Detecting libraries used...
root INFO compile-response, RECEIVED 2022-08-10T14:40:48.346Z 2 Detecting libraries used...
root INFO compile-response, SEND 2022-08-10T14:40:48.410Z 2 /Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /dev/null
Generating function prototypes...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/preproc/ctags_target_for_gcc_minus_e.cpp
root INFO compile-response, RECEIVED 2022-08-10T14:40:48.410Z 2 /Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /dev/null
Generating function prototypes...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/preproc/ctags_target_for_gcc_minus_e.cpp
root INFO compile-response, SEND 2022-08-10T14:40:48.442Z 2 /Users/a.kitta/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/preproc/ctags_target_for_gcc_minus_e.cpp
root INFO compile-response, RECEIVED 2022-08-10T14:40:48.444Z 2 /Users/a.kitta/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/preproc/ctags_target_for_gcc_minus_e.cpp
root INFO compile-response, SEND 2022-08-10T14:40:48.510Z 0 /Users/a.kitta/Documents/Arduino/min/min.ino: In function 'void setup()':
/Users/a.kitta/Documents/Arduino/min/min.ino:2:3: error: 'someerror' was not declared in this scope
   someerror
   ^~~~~~~~~
root INFO compile-response, SEND 2022-08-10T14:40:48.510Z 2 Compiling sketch...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp.o
root INFO compile-response, RECEIVED 2022-08-10T14:40:48.511Z 0 /Users/a.kitta/Documents/Arduino/min/min.ino: In function 'void setup()':
/Users/a.kitta/Documents/Arduino/min/min.ino:2:3: error: 'someerror' was not declared in this scope
   someerror
   ^~~~~~~~~
root INFO compile-response, RECEIVED 2022-08-10T14:40:48.514Z 2 Compiling sketch...
/Users/a.kitta/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/a.kitta/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/standard /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp -o /private/var/folders/z1/xkw1yh5n7rz4n8djprp1mdn80000gn/T/arduino-sketch-9AC154E96781B8A1BB81760239BC5D99/sketch/min.ino.cpp.o
root INFO compile-response, SEND 2022-08-10T14:40:48.544Z 0 /Users/a.kitta/Documents/Arduino/min/min.ino:2:3: note: suggested alternative: 'strerror'
   someerror
   ^~~~~~~~~
   strerror
root INFO compile-response, RECEIVED 2022-08-10T14:40:48.546Z 0 /Users/a.kitta/Documents/Arduino/min/min.ino:2:3: note: suggested alternative: 'strerror'
   someerror
   ^~~~~~~~~
   strerror

@kittaakos
Copy link
Contributor Author

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.

It should be fixed now.

Scrolling the output view up at the end of the compilation can cause the link to be placed on the wrong line.

It was unrelated to the scrolling, but it should work correctly now.

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.

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!

When a sketch file contains multiple error highlights, the selection is lost at each highlighted line while selecting in an upward direction.

I could not reproduce it on both macOS and Windows so far.

@kittaakos
Copy link
Contributor Author

When a sketch file contains multiple error highlights, the selection is lost at each highlighted line while selecting in an upward direction.

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

Copy link
Contributor

@per1234 per1234 left a 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!

@per1234
Copy link
Contributor

per1234 commented Aug 11, 2022

I still could not reproduce it.

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.

do you prefer to show only one error (highlighted with the "red" line) even if there are multiple errors?

I don't have a strong preference either way. I only mentioned the change because it seemed possibly related to the lost selection bug.

@kittaakos kittaakos changed the title #118 Link compiler errors to editor. #118, #1154 Link compiler errors to editor. Aug 11, 2022
Akos Kitta added 2 commits August 15, 2022 09:27
Closes #118

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Closes #1154

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Close compilation/upload error notifications on subsequent actions Link compiler errors to editor
2 participants