neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.15k stars 953 forks source link

Using Arduino Language Server #5039

Closed QwEekYhyo closed 3 weeks ago

QwEekYhyo commented 3 weeks ago

I ran into some issues when trying to use the Arduino Language Server with Coc, the server would just stop. I found a fix, in the coc-settings.json it says in your documentation to add :

"languageserver":{
  "arduino":{ 
    "command":"/path/to/arduino-language-server",
    "rootPatterns":["*.ino"],
    "filetypes":["arduino"],
    "args":["-cli", "/path/to/arduino-cli", "-clangd", "/path/to/clangd", "-cli-config", "/path/to/arduino-cli.yaml"]
  }
}

But you need to specify a Fully Qualified Board Name, that you can find by running arduino-cli board listall and choose the board you would like to use. And also apparently the Semantic Tokens are not supported by the Arduino Language Server. So this is the corrected version :

"languageserver":{
  "arduino":{ 
    "command":"/path/to/arduino-language-server",
    "rootPatterns":["*.ino"],
    "filetypes":["arduino"],
    "args":["-cli", "/path/to/arduino-cli", "-clangd", "/path/to/clangd", "-cli-config", "/path/to/arduino-cli.yaml", "-fqbn", "board:name"],
    "disabledFeatures":["semanticTokens"]
  }
}