From 54e4e18a13375cbb69ec475aafab3946fbc7a613 Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Sun, 3 Mar 2024 22:02:11 +0100 Subject: Enable null-ls prettier formatting and disable ufo.nvim --- .config/nvim/lua/lsp.lua | 56 +++++++++++++++++++++++--------------------- .config/nvim/lua/plugins.lua | 11 +++++---- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index f5e7738..db6ead9 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -73,7 +73,7 @@ cmp.setup.cmdline(":", { -- Setup lspconfig. local capabilities = vim.lsp.protocol.make_client_capabilities() -cmplsp.default_capabilities(vim.lsp.protocol.make_client_capabilities()) +cmplsp.default_capabilities(capabilities) -- Enable (broadcasting) snippet capability for completion capabilities.textDocument.completion.completionItem.snippetSupport = true @@ -116,7 +116,10 @@ vim.api.nvim_create_autocmd("LspAttach", { local lsputils = lspconfig.util lspconfig.tsserver.setup({ - on_attach = on_attach; + on_attach = function(client, bufnr) + client.resolved_capabilities.document_formatting = false + on_attach(client, bufnr) + end; root_dir = lsputils.root_pattern("package.json", "tsconfig.json"); single_file_mode = false; settings = { @@ -246,7 +249,7 @@ lspconfig.clangd.setup({ capabilities = capabilities; on_attach = on_attach }) -- lspconfig.dockerls.setup({ capabilities = capabilities; on_attach = on_attach }) -lspconfig.eslint.setup({ capabilities = capabilities; on_attach = on_attach }) +-- lspconfig.eslint.setup({ capabilities = capabilities; on_attach = on_attach }) lspconfig.lua_ls.setup({ capabilities = capabilities; @@ -277,30 +280,29 @@ lspconfig.jedi_language_server.setup({}) lspconfig.gopls.setup({}) --- Deprecated --- local null_ls = require("null-ls") - --- null_ls.setup({ --- sources = { --- -- null_ls.builtins.diagnostics.eslint; --- -- null_ls.builtins.formatting.eslint; --- null_ls.builtins.formatting.lua_format; --- -- null_ls.builtins.formatting.prettier; --- null_ls.builtins.formatting.rustfmt; --- -- null_ls.builtins.code_actions.shellcheck; --- -- null_ls.builtins.completion.spell; --- -- null_ls.builtins.diagnostics.tsc; --- -- null_ls.builtins.formatting.deno_fmt; --- -- null_ls.builtins.code_actions.gitsigns.with({ --- -- config = { --- -- filter_actions = function(title) --- -- -- filter out blame actions --- -- return title:lower():match("blame") == nil --- -- end; --- -- }; --- -- }); --- }; --- }) +local null_ls = require("null-ls") + +null_ls.setup({ + sources = { + -- null_ls.builtins.diagnostics.eslint; + -- null_ls.builtins.formatting.eslint; + -- null_ls.builtins.formatting.lua_format; + null_ls.builtins.formatting.prettier; + -- null_ls.builtins.formatting.rustfmt; + -- null_ls.builtins.code_actions.shellcheck; + -- null_ls.builtins.completion.spell; + -- null_ls.builtins.diagnostics.tsc; + -- null_ls.builtins.formatting.deno_fmt; + -- null_ls.builtins.code_actions.gitsigns.with({ + -- config = { + -- filter_actions = function(title) + -- -- filter out blame actions + -- return title:lower():match("blame") == nil + -- end; + -- }; + -- }); + }; +}) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 8506e15..4a66b42 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -72,6 +72,7 @@ local PKGS = { { url = "https://github.com/lewis6991/gitsigns.nvim.git" }; -- Deprecated -- { url = "https://github.com/jose-elias-alvarez/null-ls.nvim.git" }; + { url = "https://github.com/nvimtools/none-ls.nvim.git" }; { url = "https://github.com/mfussenegger/nvim-dap.git" }; { url = "https://github.com/rcarriga/nvim-dap-ui.git" }; { url = "https://github.com/antoinemadec/FixCursorHold.nvim.git" }; @@ -165,11 +166,11 @@ local function init_plugins() vim.g.minimap_highlight_range = 1 vim.g.minimap_highlight_search = 1 - ufo.setup({ - provider_selector = function(bufnr, filetype, buftype) - return { "treesitter"; "indent" } - end; - }); + -- ufo.setup({ + -- provider_selector = function(bufnr, filetype, buftype) + -- return { "treesitter"; "indent" } + -- end; + -- }); catppuccin.setup({ transparent_background = true; -- cgit v1.2.3