Skip to content

LSP cannot find definitions from std libraries in the toolchain #190

Open
@saippua

Description

@saippua

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 #186 (comment)

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions