mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 01:08:43 +02:00
plugins/lsp: make lspOnAttach available globally
Allows plugins to utilize the global nixvim table to access the lsp on attach function and prevent needing to filter attribute set or manage the property explicitly in lua.
This commit is contained in:
parent
8a272143ee
commit
1e74f3deab
1 changed files with 3 additions and 2 deletions
|
@ -225,7 +225,8 @@ in
|
||||||
${cfg.preConfig}
|
${cfg.preConfig}
|
||||||
|
|
||||||
local __lspServers = ${helpers.toLuaObject cfg.enabledServers}
|
local __lspServers = ${helpers.toLuaObject cfg.enabledServers}
|
||||||
local __lspOnAttach = function(client, bufnr)
|
-- Adding lspOnAttach function to nixvim module lua table so other plugins can hook into it.
|
||||||
|
_M.lspOnAttach = function(client, bufnr)
|
||||||
${updateCapabilities}
|
${updateCapabilities}
|
||||||
|
|
||||||
${cfg.onAttach}
|
${cfg.onAttach}
|
||||||
|
@ -239,7 +240,7 @@ in
|
||||||
end
|
end
|
||||||
|
|
||||||
local __setup = ${runWrappers cfg.setupWrappers "{
|
local __setup = ${runWrappers cfg.setupWrappers "{
|
||||||
on_attach = __lspOnAttach,
|
on_attach = _M.lspOnAttach,
|
||||||
capabilities = __lspCapabilities()
|
capabilities = __lspCapabilities()
|
||||||
}"}
|
}"}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue