Skip to content

Certain errors in libraries can stop the language server #1042

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

Open
3 tasks done
PaulStoffregen opened this issue Jun 10, 2022 · 5 comments
Open
3 tasks done

Certain errors in libraries can stop the language server #1042

PaulStoffregen opened this issue Jun 10, 2022 · 5 comments
Assignees
Labels
topic: language server Related to the Arduino Language Server type: imperfection Perceived defect in any part of project

Comments

@PaulStoffregen
Copy link

PaulStoffregen commented Jun 10, 2022

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
@PaulStoffregen PaulStoffregen added the type: imperfection Perceived defect in any part of project label Jun 10, 2022
@per1234 per1234 added the topic: language server Related to the Arduino Language Server label Jun 11, 2022
@marcusobrien
Copy link

I am seeing this also on my sketch when trying to use the lvgl GUI lib and ESP32S3 etc. Dont know what is causing this, but it would be helpful if for example the error told you the file that was cuasing it so we casn actually investigate it

"Error communicating with the language server: Error: write EOF: undefined."

Can you now make the error "Error communicating with the language server: Error: write EOF: undefined in file %s"

@TzOk83

This comment was marked as resolved.

@per1234
Copy link
Contributor

per1234 commented Jun 11, 2023

Hi @marcusobrien and @TzOk83. Thanks for your reports. I'm going to ask you to provide the debug logs that are produced by the "Arduino Language Server" tool.

You can do that by following these instructions:

A. Enable Language Server Logging

  1. Use the Ctrl/+Shift+P keyboard shortcut to open the "Command Palette" in Arduino IDE.
  2. Select the "Preferences: Open Settings (UI)" command from the "Command Palette".
    The "Preferences" tab will now open in the editor panel.
  3. In the "Search Settings" field, type arduino.language.log
  4. Under the "Arduino > Language: Log", section, check the box next to "☐ True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default."
  5. Close the Preferences tab by clicking its X icon.

B. Gather Logs

  1. Perform whatever procedure causes this "Error: write EOF: undefined error in Arduino IDE.
  2. Select Sketch > Show Sketch Folder from the Arduino IDE menus.
    The folder containing the sketch will open in your file manager.
  3. ZIP the entire sketch folder.
    • Instructions for Windows:
      1. Right click the sketch folder.
      2. From the context menu that opens, select "Send to".
      3. Select "Compressed (zipped) folder" from the "Send to" menu.
    • Instructions for Linux:
      1. Right click the sketch folder.
      2. From the context menu that opens, select "Compress...".
      3. In the "Create Archive" dialog that opens, click the Create button.
    • Instructions for macOS:
      1. Control-click the sketch folder.
      2. From the shortcut menu that opens, select "Compress"
  4. Attach the "ZIP" file that was created to a comment here on this GitHub issue.
    ⚠ Don't use an email reply to make the comment. You must make the comment via the web interface here on the GitHub website in order for the attachment to be made:
    https://github.com/arduino/arduino-ide/issues/1042
    You can do this by drag and dropping the file onto the comment field, or by clicking the bar at the bottom of the comment interface.

C. Disable Language Server Logging

When language server logging is enabled, log files are saved to every sketch you open in Arduino IDE and they steadily grow in size whenever you are editing the sketch. So the logging is something you would usually want to disable whenever generation of logs is not needed.

  1. Use the Ctrl/+Shift+P keyboard shortcut to open the "Command Palette" in Arduino IDE.
  2. Select the "Preferences: Open Settings (UI)" command from the "Command Palette".
    The "Preferences" tab will now open in the editor panel.
  3. In the "Search Settings" field, type arduino.language.log
  4. Under the "Arduino > Language: Log", section, uncheck the box next to " True if the Arduino Language Server should generate log files into the sketch folder. Otherwise, false. It's false by default."
  5. Close the Preferences tab by clicking its X icon.

You are now welcome to delete the .log files that were added to the sketch folder.

@TzOk83

This comment was marked as off-topic.

@per1234

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: language server Related to the Arduino Language Server type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

5 participants