How to add a custom server to `nvim-lspconfig`?

I have been redirected here from nvim-lspconfig/issues/new.

I remembered that in the past there was a section in the readme/wiki on how to add a custom lsp server, but it was removed. I looked it up in the git history and tried using the code and it didn’t work (it said the server’s configuration was not found even though I was manually assigning it to lspconfig.configs).

I managed to get it to work by going into lspconfig directory and creating the config there, but I am looking for a less hacky solution. I’d be interested in the following questions:

  1. Why was the custom guide removed?
  2. What is the recommended way currently?

(I am the creator of woke, an lsp for the Ethereum-based language Solidity, and was trying to enable it for neovim, after supporting Vs Code for many months) Thanks!

I was able to do it like this:

local lsp = require 'lspconfig'

vim.tbl_deep_extend('keep', lsp, {
	lsp_name = {
		cmd = { 'command' },
		filetypes = 'filetype',
		name = 'lsp_name',
1 Like

This works thanks. Weird that we didn’t get an official response. Only confirms my suspicion that these forums are useless and it’s better to raise Github issues :joy:

You might not need lspconfig at all. It is not required to use LSP with Neovim.

You can use the following code either in an ftplugin for your filetype, or in a FileType autocommand:

  cmd = { "command" },
  root_dir = vim.fn.getcwd(), -- Use PWD as project root dir.

There is more info at :h vim.lsp.start().

Weird that we didn’t get an official response

Keep in mind that many of the Neovim maintainers do not use nvim-lspconfig. It is mostly a community maintained plugin.

1 Like