arduino / arduino-language-server

An Arduino Language Server based on Clangd to Arduino code autocompletion
GNU Affero General Public License v3.0
117 stars 11 forks source link

Language sever unable to locate libraries in the $HOME/Arduino/libraries directory #163

Open tomhepworth opened 1 year ago

tomhepworth commented 1 year ago

I have the standard configuration of arduino-language-server in neovim.

The line #include <Wire.h> gives me a "file not found" error. The same with other libraries. I have generated a compile_commands.json with arduino-cli but this does not make any difference.

Is there a way to pass include paths to the language server?

My configuration:

local DEFAULT_FBQN="arduino:avr:uno"

local MY_FQBN = DEFAULT_FBQN

print(MY_FQBN)

require'lspconfig'.arduino_language_server.setup{
    cmd = {
        "arduino-language-server",
    "-clangd",
    "/usr/local/bin/clangd",
    "-cli", 
    "/usr/local/bin/arduino-cli",
        "-cli-config",
    "/home/.../thomas.hepworth/.arduino15/arduino-cli.yaml",
        "-fqbn",
        MY_FQBN
    }
}
nabakolu commented 5 months ago

I do have the same problem. But including your libraries (which are 'file not found'), then compiling once with arduino-cli fixes this for me.