mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
feat: use LazyVim everywhere instead of require("lazyvim.util")
This commit is contained in:
parent
3a87c08cda
commit
7a5dbeae75
41 changed files with 188 additions and 229 deletions
|
@ -1,5 +1,3 @@
|
|||
local Util = require("lazyvim.util")
|
||||
|
||||
return {
|
||||
-- lspconfig
|
||||
{
|
||||
|
@ -95,22 +93,22 @@ return {
|
|||
},
|
||||
---@param opts PluginLspOpts
|
||||
config = function(_, opts)
|
||||
if Util.has("neoconf.nvim") then
|
||||
if LazyVim.has("neoconf.nvim") then
|
||||
local plugin = require("lazy.core.config").spec.plugins["neoconf.nvim"]
|
||||
require("neoconf").setup(require("lazy.core.plugin").values(plugin, "opts", false))
|
||||
end
|
||||
|
||||
-- setup autoformat
|
||||
Util.format.register(Util.lsp.formatter())
|
||||
LazyVim.format.register(LazyVim.lsp.formatter())
|
||||
|
||||
-- deprecated options
|
||||
if opts.autoformat ~= nil then
|
||||
vim.g.autoformat = opts.autoformat
|
||||
Util.deprecate("nvim-lspconfig.opts.autoformat", "vim.g.autoformat")
|
||||
LazyVim.deprecate("nvim-lspconfig.opts.autoformat", "vim.g.autoformat")
|
||||
end
|
||||
|
||||
-- setup keymaps
|
||||
Util.lsp.on_attach(function(client, buffer)
|
||||
LazyVim.lsp.on_attach(function(client, buffer)
|
||||
require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer)
|
||||
end)
|
||||
|
||||
|
@ -134,16 +132,16 @@ return {
|
|||
|
||||
-- inlay hints
|
||||
if opts.inlay_hints.enabled then
|
||||
Util.lsp.on_attach(function(client, buffer)
|
||||
LazyVim.lsp.on_attach(function(client, buffer)
|
||||
if client.supports_method("textDocument/inlayHint") then
|
||||
Util.toggle.inlay_hints(buffer, true)
|
||||
LazyVim.toggle.inlay_hints(buffer, true)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- code lens
|
||||
if opts.codelens.enabled and vim.lsp.codelens then
|
||||
Util.lsp.on_attach(function(client, buffer)
|
||||
LazyVim.lsp.on_attach(function(client, buffer)
|
||||
if client.supports_method("textDocument/codeLens") then
|
||||
vim.lsp.codelens.refresh()
|
||||
--- autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()
|
||||
|
@ -220,10 +218,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 LazyVim.lsp.get_config("denols") and LazyVim.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)
|
||||
LazyVim.lsp.disable("tsserver", is_deno)
|
||||
LazyVim.lsp.disable("denols", function(root_dir)
|
||||
return not is_deno(root_dir)
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue