Skip to content

Instantly share code, notes, and snippets.

@pstuifzand
Last active December 23, 2025 16:52
Show Gist options
  • Select an option

  • Save pstuifzand/6efa1bac4618252d9e44297c36c0ef77 to your computer and use it in GitHub Desktop.

Select an option

Save pstuifzand/6efa1bac4618252d9e44297c36c0ef77 to your computer and use it in GitHub Desktop.
Install Home Assistant Language Server on Neovim (v0.5 prerelease)

Install on Neovim (v0.5 prerelease)

The Home Assistant language server can be used with Neovim.

Install vscode-home-assistant

  1. Download the latest release from the releases.
  2. Unpack the archive.
  3. Run npm install
  4. Run npm run compile
  5. The language server is ready to be run
  6. Set HASS_SERVER=... and HASS_TOKEN=... in your environment. See also: Configure connection to HA.

Install in Neovim

  1. Requires neovim v0.5 prerelease. See nvim-lspconfig for more information.
  2. 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
@mehalter
Copy link

I have added this to nvim-lspconfig (neovim/nvim-lspconfig#4248) and Mason.nvim (mason-org/mason-registry#12847).

If you use lspconfig then it should be as easy as vim.lsp.enable('home_assistant')

If you use Mason.nvim then you can just install the vscode-home-assistant package. Paired with mason-lspconfig it could be fully automated getting it set up and configured.

@syyyr
Copy link

syyyr commented Dec 23, 2025

I have updated the binary name of the AUR package to "vscode-home-assistant" so that it works with the nvim-lspconfig config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment