Skip to content

Output error message if --fqbn parameter is missing #207

Open
@deanqx

Description

@deanqx

Describe the request

I spend hours trying to find out why the LSP is not working with Neovim. This was the error message in ~/.local/state/nvim/lsp.log:

INIT --- : error starting clang: running --config-file /home/dean/.arduino15/arduino-cli.yaml compile --fqbn  --only-compilation-database --source-override /tmp/2284650797 --build-path /tmp/arduino-language-server3269529476/fullbuild --format json 
/home/dean/git/Arduino/SevenSeg: exit status 1
textDocument/didOpen: \27[93mlocked (waiting clangd)
textDocument/didOpen: clangd startup failed: quitting Language server

It misleadingly hinted that clangd was the problem. But actually was the --fqbn parameter empty.

The final solution was to create a sketch.yaml file in the Sketch directory, which contained the FQBN. I found the solution in the nvim-lspconfig repo.

default_fqbn: arduino:avr:uno

My suggestion is to explicitly output "FQBN is missing" which is done when you launch the arduino-cli.

Describe the current behavior

  • Neovim v11 with nvim-lspconfig
  1. Setup arduino-language-server with Neovim.

  2. Setup demo project:

cd /tmp
mkdir test_project
cd test_project
echo "void setup() {} void loop() {}" > test_project.ino
  1. Open Sketch with Neovim:
nvim test_project.ino

With a configured Neovim setup the language server should try to connect and fail. An error message is shown arduino-language-server failed to start with code 2. If nothing is appearing, check the connection with :LspInfo.

Arduino Language Server version

0.7.7-1

Arduino CLI version

1.1.1 Commit: fa6eafcbbea301eeece900f0501e88d288487974

Operating system

Linux

Operating system version

Up to date, rolling release

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest version
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions