Skip to content

Certain errors in libraries can stop the language server #1042

Open
@PaulStoffregen

Description

@PaulStoffregen

Describe the problem

I discovered erroneous code which causes the language server to stop running.

To reproduce

Using Arduino IDE 2.0.0-rc7.

1: add https://www.pjrc.com/teensy/td_156/package_teensy_index.json to additional board manager URLs in File > Preferences

2: in boards manager, search for "teensy" and install Teensy package 1.56.1

3: set the current board to Tools > Board > Teensy > Teensy 4.1

4: copy this code into the IDE editor

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.printf("test\n");
  delay(1000);
}

5: hover your mouse over "printf" and this popup with info from the language server should appear.
image

6: quit the IDE, and edit ~/.arduino15/packages/teensy/hardware/avr/1.56.1/cores/teensy4/Print.h

7: on line 115, delete the semicolon at the end of the line and save the file with this intentional error
image
image

8: restart the IDE and again hover your mouse over "printf", same as in step 5 - but not the popup does not appear. Hovering over other keywords also gives no results, and other language server feature no longer work.
image

Expected behavior

Even though the Print.h code has an error, one would expect the language server to give some guidance about the error, at at least continue running. It shouldn't just stop and no longer function, just because code is missing a semicolon.

Arduino IDE version

2.0.0-rc7

Operating system

Linux

Operating system version

Ubuntu 20.04

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions