arduino-language-server icon indicating copy to clipboard operation
arduino-language-server copied to clipboard

LSP cannot find definitions from std libraries in the toolchain

Open saippua opened this issue 7 months ago • 0 comments

Describe the problem

Here is a very simple example which compiles and runs on my ESP32.

// #include <stdint.h> // not necessary to build.

void setup() {
    Serial.begin(115200);

    uint8_t value = 42;
    Serial.println(value);
}

void loop() {
}

Arduino LSP complains Unknown type name 'uint8_t' in the setup() function.

To reproduce

I have Arduino LSP (0.7.6) setup on a downgraded Neovim v0.9.5 with semantic tokens disabled as per https://github.com/arduino/arduino-language-server/issues/186#issuecomment-2163849349

Also installed: clangd v17.0.6

I have tried creating a compilation database with arduino-cli. From there I can see that ~/.arduino15/packages/esp32/tools/esp-x32/2302/bin/xtensa-esp32-elf-g++ is being used for compilation. stdint.h is part of that toolchain, so I don't know why arduino LSP is not finding it, even though arduino-cli clearly does find it, because the code compiles.

Expected behavior

Arduino LSP should find dependencies from the toolchain automatically, or there should be some way to manually specify the toolchain, like with clangd's --query-driver

Arduino Language Server version

0.7.6

Arduino CLI version

0.35.3

Operating system

Linux

Operating system version

NixOS 2.18.4

Additional context

I am using the esp32 core (esp32:esp32, v3.0.1)

Issue checklist

  • [X] I searched for previous reports in the issue tracker
  • [X] I verified the problem still occurs when using the latest version
  • [X] My report contains all necessary details

saippua avatar Jul 20 '24 10:07 saippua