Skip to content

Commit ada5f7d

Browse files
Fix nvim lsp (#98)
* Fix Neovim LSP Configuration Recently, nvim had breaking changes for adding LSP configurations. See also https://www.reddit.com/r/neovim/comments/r8p0ye/lspconfig_ensure_this_server_is_listed_in_server/ * Clean up Neovim LSP Configuration Have it work out of the box.
1 parent 0dfeb84 commit ada5f7d

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,24 @@ this to your [coc.nvim configuration file][vim_coc_nvim_config_file]:
8787
This requires [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig).
8888
```lua
8989
lua << EOF
90-
local lspconfig = require'lspconfig'
9190
-- Only define once
92-
if not lspconfig.hdl_checker then
93-
require'lspconfig/configs'.hdl_checker = {
91+
if not require'lspconfig.configs'.hdl_checker then
92+
require'lspconfig.configs'.hdl_checker = {
9493
default_config = {
9594
cmd = {"hdl_checker", "--lsp", };
9695
filetypes = {"vhdl", "verilog", "systemverilog"};
9796
root_dir = function(fname)
98-
-- will look for a parent directory with a .git directory. If none, just
99-
-- use the current directory
100-
return lspconfig.util.find_git_ancestor(fname) or lspconfig.util.path.dirname(fname)
101-
-- or (not both)
102-
-- Will look for the .hdl_checker.config file in a parent directory. If
103-
-- none, will use the current directory
104-
return lspconfig.util.root_pattern('.hdl_checker.config')(fname) or lspconfig.util.path.dirname(fname)
97+
-- will look for the .hdl_checker.config file in parent directory, a
98+
-- .git directory, or else use the current directory, in that order.
99+
local util = require'lspconfig'.util
100+
return util.root_pattern('.hdl_checker.config')(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname)
105101
end;
106102
settings = {};
107103
};
108104
}
109105
end
110106

111-
lspconfig.hdl_checker.setup()
107+
require'lspconfig'.hdl_checker.setup{}
112108

113109
EOF
114110
```

0 commit comments

Comments
 (0)