Published on: Wed Dec 17 2025

Tags: nvim, go, python, astro


Minimal LSP configuration (Neovim v0.11+)

Background

Starting from Neovim v0.11, LSP configuration can be simpler. I was using lsp-config, mason, etc., for LSP, but they aren’t really necessary anymore.

https://gpanders.com/blog/whats-new-in-neovim-0-11/

LSP for each language

Astro

I followed this page, but this error occurred.

Error executing vim.schedule lua callback: .../neovim/0.11.2/share/nvim/runtime/lua/vim/lsp/client.lua:544: RPC[Error] code_name = InternalError, message = "Request initialize f
ailed with message: The `typescript.tsdk` init option is required. It should point to a directory containing a `typescript.js` or `tsserverlibrary.js` file, such as `node_module
s/typescript/lib`."

Therefore, I manually specified the tsdk path.

Here is the configuration for my Mac.

return {
  cmd = { 'astro-ls', '--stdio' },
  filetypes = { 'astro' },
  root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' },
  init_options = {
    typescript = {
      -- You can find the tsdk path by running `npm root -g` and appending `/typescript/lib` to the path of astro language server.
      tsdk = '/opt/homebrew/lib/node_modules/@astrojs/language-server/node_modules/typescript/lib'
    },
  },
}

Python

Here is my configuration as of now. A virtual environment path might need to be specified.

return {
  cmd = { "pyright-langserver", "--stdio" },
	settings = {
		python = {
			analysis = {
				typeCheckingMode = "basic",
				autoSearchPaths = true,
				useLibraryCodeForTypes = true,
				diagnosticMode = "openFilesOnly",
			},
		},
	},
}

Go

I confirmed that I could open Go files without any errors with this configuration.

return {
  cmd = {"gopls"},
  filetypes = { "go", "gomod", "gowork", "gotmpl" },
  root_dir = util.root_pattern("go.work", "go.mod", ".git"),
  settings = {
    gopls = {
      completeUnimported = true,
      usePlaceholders = true,
      analyses = {
        unusedparams = true,
      },
    },
  },
}