Hi there,
i’m trying to setup the arduino language server, without success.
I guess there is something wrong or missing in the configuration, but i don’t know what it is.
Any help or tip is appreciated.
My Setup:
- macos Big Sur / 11.6
- neovim 0.5.1
- Arduino IDE 2 provides arduino-cli, arduino language server and clangd
- checkhealth
health#lspconfig#check
========================================================================
## Checking language server protocol configuration
- INFO: arduino_language_server: configuration checked.
health#nvim#check
========================================================================
## Configuration
- OK: no issues found
## Performance
- OK: Build type: Release
## Remote Plugins
- OK: Up to date
## terminal
- INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
- INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
- INFO: $COLORTERM='truecolor'
- Lspinfo
Language client log: /Users/lars/.cache/nvim/lsp.log
~ Detected filetype: arduino
~
~ 1 client(s) attached to this buffer:
~
~ Client: arduino_language_server (id: 1, pid: 51136, bufnr: [2])
~ filetypes: arduino
~ autostart: true
~ root directory: /Users/lars/Desktop
~ cmd: /Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server -cli-config /Users/lars/Library/Arduino15/arduino-cli.yaml -cli /Application
~ s/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-cli -clangd /Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/bin/clangd
~
~ Configured servers list: arduino_language_server
- lsp.log
[START][2021-11-03 14:28:47] LSP logging initiated
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" "2021/11/03 14:28:54 \27[92mIDE --> LS CL: REQUEST initialize 1: \27[0m\n"
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" "2021/11/03 14:28:54 IDE --> initialize 1 \27[93m locked\27[0m\n"
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" "2021/11/03 14:28:54 IDE --> initialize 1 \27[93m unlocked\27[0m\n"
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" "2021/11/03 14:28:54 INIT--- initializing workbench\n2021/11/03 14:28:54 INIT--- \27[93m locked\27[0m\n2021/11/03 14:28:54 \27[91mIDE <-- LS CL: ANSWER UNBOUND (1): \27[0m\n2021/11/03 14:28:54 --> initialize(file:///Users/lars/Desktop)\n"
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" "2021/11/03 14:28:54 running: /Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-cli --config-file /Users/lars/Library/Arduino15/arduino-cli.yaml compile --fqbn arduino:avr:uno --only-compilation-database --clean --source-override /var/folders/gb/xn0l1h3d6sbc9sh6mbzck6nc0000gn/T/548995187 --build-path /private/var/folders/gb/xn0l1h3d6sbc9sh6mbzck6nc0000gn/T/arduino-language-server049125476 --format json /Users/lars/Desktop\n"
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" "2021/11/03 14:28:54 \27[92mIDE --> LS CL: NOTIFICATION initialized: \27[0m\n"
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" '2021/11/03 14:28:54 arduino-cli output: {\n "compiler_out": "",\n "compiler_err": "",\n "builder_result": null,\n "success": false\n}\n\n'
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" "2021/11/03 14:28:54 INIT--- initializing workbench (done)\n2021/11/03 14:28:54 INIT--- \27[93m unlocked\27[0m\n2021/11/03 14:28:54 IDE --> initialized notif1 \27[93m read-locked\27[0m\n"
[ERROR][2021-11-03 14:28:54] .../vim/lsp/rpc.lua:462 "rpc" "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server" "stderr" "2021/11/03 14:28:54 IDE --> initialized notif1 notification is not propagated to clangd\n2021/11/03 14:28:54 IDE --> initialized notif1 \27[93m read-unlocked\27[0m\n2021/11/03 14:28:54 \27[92mIDE --> LS CL: NOTIFICATION textDocument/didOpen: \27[0m\n2021/11/03 14:28:54 IDE --> textDocument/didOpen notif2 \27[93m locked\27[0m\n2021/11/03 14:28:54 IDE --> textDocument/didOpen notif2 (throttled: waiting for clangd)\n2021/11/03 14:28:54 IDE --> textDocument/didOpen notif2 \27[93m unlocked (waiting clangd)\27[0m\n"
- init.vim
" vim-plug
call plug#begin(stdpath('data') . '/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'arduino/arduino-language-server'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
" Initialize plugin system
call plug#end()
set completeopt=menu,menuone,noselect
" Arduino LAnguage Server
"
lua <<EOF
vim.lsp.set_log_level("error")
-- Setup lspconfig.
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require'lspconfig'.arduino_language_server.setup({
capabilities = capabilities,
cmd = { "/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-language-server",
"-cli-config","/Users/lars/Library/Arduino15/arduino-cli.yaml",
"-cli","/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/arduino-cli",
"-clangd","/Applications/Arduino IDE.app/Contents/Resources/app/node_modules/arduino-ide-extension/build/bin/clangd",
}
})
-----
-- Setup nvim-cmp.
local cmp = require'cmp'
cmp.setup({
mapping = {
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<S-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
}, {
{ name = 'buffer' },
})
})
--[[
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
--]]
EOF