diff options
| author | aaaaargZombies <alfiejameskahn@gmail.com> | 2022-12-31 01:58:31 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-31 09:58:31 +0800 |
| commit | 375d6768d9859097a95ea1dc495bd4b7a9f799f3 (patch) | |
| tree | 02101be5a2995cc6ca92ef197792e5a2589764e1 /lua | |
| parent | refactor: rewrite client reuse logic (#2371) (diff) | |
| download | nvim-lspconfig-375d6768d9859097a95ea1dc495bd4b7a9f799f3.tar nvim-lspconfig-375d6768d9859097a95ea1dc495bd4b7a9f799f3.tar.gz nvim-lspconfig-375d6768d9859097a95ea1dc495bd4b7a9f799f3.tar.bz2 nvim-lspconfig-375d6768d9859097a95ea1dc495bd4b7a9f799f3.tar.lz nvim-lspconfig-375d6768d9859097a95ea1dc495bd4b7a9f799f3.tar.xz nvim-lspconfig-375d6768d9859097a95ea1dc495bd4b7a9f799f3.tar.zst nvim-lspconfig-375d6768d9859097a95ea1dc495bd4b7a9f799f3.zip | |
feat: include cmd option for arduino_language_server (#2242)
* feat: include cmd option for arduino_language_server
update docs to reflect new usage
* fix: format with stylua
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/arduino_language_server.lua | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/lua/lspconfig/server_configurations/arduino_language_server.lua b/lua/lspconfig/server_configurations/arduino_language_server.lua index b7f529ff..bab4a073 100644 --- a/lua/lspconfig/server_configurations/arduino_language_server.lua +++ b/lua/lspconfig/server_configurations/arduino_language_server.lua @@ -4,6 +4,9 @@ return { default_config = { filetypes = { 'arduino' }, root_dir = util.root_pattern '*.ino', + cmd = { + 'arduino-language-server', + }, }, docs = { description = [[ @@ -26,37 +29,55 @@ instructions](https://arduino.github.io/arduino-cli/latest/getting-started/#crea for generating a configuration file if you haven't done so already, and make sure you [install any relevant platforms libraries](https://arduino.github.io/arduino-cli/latest/getting-started/#install-the-core-for-your-board). -Make sure to save the full path to the created `arduino-cli.yaml` file for later. The language server also requires `clangd` to be installed. Follow [these installation instructions](https://clangd.llvm.org/installation) for your platform. -Next, you will need to decide which FQBN to use. -To identify the available FQBNs for boards you currently have connected, you may use the `arduino-cli` command, like so: +If you don't have a sketch yet create one. + +```sh +$ arduino-cli sketch new test +$ cd test +``` + +You will need a `sketch.json` file in order for the language server to understand your project. It will also save you passing options to `arduino-cli` each time you compile or upload a file. You can generate the file like using the following commands. + + +First gather some information about your board. Make sure your board is connected and run the following: ```sh $ arduino-cli board list Port Protocol Type Board Name FQBN Core /dev/ttyACM0 serial Serial Port (USB) Arduino Uno arduino:avr:uno arduino:avr - ^^^^^^^^^^^^^^^ ``` -After all dependencies are installed you'll need to set the command for the -language server in your setup: +Then generate the file: + +```sh +arduino-cli board attach -p /dev/ttyACM0 test.ino +``` + +The resulting file should like like this: -```lua -require'lspconfig'.arduino_language_server.setup { - cmd = { - "arduino-language-server", - "-cli-config", "/path/to/arduino-cli.yaml", - "-fqbn", "arduino:avr:uno", - "-cli", "arduino-cli", - "-clangd", "clangd" +```json +{ + "cpu": { + "fqbn": "arduino:avr:uno", + "name": "Arduino Uno", + "port": "serial:///dev/ttyACM0" } } ``` +Your folder structure should look like this: + +``` +. +├── test.ino +└── sketch.json +``` + For further instruction about configuration options, run `arduino-language-server --help`. ]], }, |
