perf(util): split lazyvim.util in smaller separate modules
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
return {
|
||||
-- lspconfig
|
||||
{
|
||||
@ -88,6 +90,8 @@ return {
|
||||
require("lazyvim.plugins.lsp.format").setup(opts)
|
||||
-- setup formatting and keymaps
|
||||
Util.on_attach(function(client, buffer)
|
||||
-- setup keymaps
|
||||
Util.lsp.on_attach(function(client, buffer)
|
||||
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
|
||||
end)
|
||||
|
||||
@ -112,7 +116,7 @@ return {
|
||||
local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint
|
||||
|
||||
if opts.inlay_hints.enabled and inlay_hint then
|
||||
Util.on_attach(function(client, buffer)
|
||||
Util.lsp.on_attach(function(client, buffer)
|
||||
if client.supports_method("textDocument/inlayHint") then
|
||||
inlay_hint(buffer, true)
|
||||
end
|
||||
@ -184,10 +188,10 @@ return {
|
||||
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
|
||||
end
|
||||
|
||||
if Util.lsp_get_config("denols") and Util.lsp_get_config("tsserver") then
|
||||
if Util.lsp.get_config("denols") and Util.lsp.get_config("tsserver") then
|
||||
local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc")
|
||||
Util.lsp_disable("tsserver", is_deno)
|
||||
Util.lsp_disable("denols", function(root_dir)
|
||||
Util.lsp.disable("tsserver", is_deno)
|
||||
Util.lsp.disable("denols", function(root_dir)
|
||||
return not is_deno(root_dir)
|
||||
end)
|
||||
end
|
||||
@ -208,7 +212,6 @@ return {
|
||||
nls.builtins.diagnostics.fish,
|
||||
nls.builtins.formatting.stylua,
|
||||
nls.builtins.formatting.shfmt,
|
||||
-- nls.builtins.diagnostics.flake8,
|
||||
},
|
||||
}
|
||||
end,
|
||||
|
Reference in New Issue
Block a user