The Home Assistant language server can be used with Neovim.
- Download the latest release from the releases.
- Unpack the archive.
- Run
npm install
- Run
npm run compile
- The language server is ready to be run
- Set
HASS_SERVER=...
andHASS_TOKEN=...
in your environment. See also: Configure connection to HA.
- Requires neovim v0.5 prerelease. See nvim-lspconfig for more information.
- Add the language server to your init.vim.
lua << EOF
local lspconfig = require('lspconfig')
local util = require('lspconfig/util')
install_dir = '/home/peter/tmp/vscode-home-assistant-1.18.0/'
-- add the default config for homeassistant
lspconfig.configs.homeassistant = {
default_config = {
cmd = {install_dir .. '/node_modules/.bin/ts-node', install_dir .. '/out/server/server.js', '--stdio'},
filetypes = {'yaml'},
root_dir = util.root_pattern("configuration.yaml"),
settings = {}
}
}
-- setup the language server (use the `on_attach` from [nvim-lspconfig][lspconfig-keybindings])
lspconfig.homeassistant.setup({ on_attach = on_attach})
EOF
Any idea if it's possible to run all the neat reload actions through Neovim LSP? Or are those only part of the vscode plugin?