From e98fcf127bffac920a4e3bc31c8be4c4ced4e630 Mon Sep 17 00:00:00 2001 From: Tyler Kelley Date: Wed, 15 May 2024 23:59:01 -0500 Subject: [PATCH] Mason no worky and I shouldve known, but I am big dumb so --- config/nvim/plugins/lsp.lua | 128 ++-------------------------------- config/nvim/plugins/mason.lua | 43 ------------ hosts/familypc/home.nix | 14 ++-- 3 files changed, 16 insertions(+), 169 deletions(-) delete mode 100644 config/nvim/plugins/mason.lua diff --git a/config/nvim/plugins/lsp.lua b/config/nvim/plugins/lsp.lua index 939b2d6..b9dcbee 100644 --- a/config/nvim/plugins/lsp.lua +++ b/config/nvim/plugins/lsp.lua @@ -1,124 +1,8 @@ local lspconfig = require("lspconfig") --- import mason_lspconfig plugin -local mason_lspconfig = require("mason-lspconfig") - --- import cmp-nvim-lsp plugin -local cmp_nvim_lsp = require("cmp_nvim_lsp") - -local keymap = vim.keymap -- for conciseness - -vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), - callback = function(ev) - -- Buffer local mappings. - -- See `:help vim.lsp.*` for documentation on any of the below functions - local opts = { buffer = ev.buf, silent = true } - - -- set keybinds - opts.desc = "Show LSP references" - keymap.set("n", "gR", "Telescope lsp_references", opts) -- show definition, references - - opts.desc = "Go to declaration" - keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration - - opts.desc = "Show LSP definitions" - keymap.set("n", "gd", "Telescope lsp_definitions", opts) -- show lsp definitions - - opts.desc = "Show LSP implementations" - keymap.set("n", "gi", "Telescope lsp_implementations", opts) -- show lsp implementations - - opts.desc = "Show LSP type definitions" - keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) -- show lsp type definitions - - opts.desc = "See available code actions" - keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection - - opts.desc = "Smart rename" - keymap.set("n", "rn", vim.lsp.buf.rename, opts) -- smart rename - - opts.desc = "Show buffer diagnostics" - keymap.set("n", "D", "Telescope diagnostics bufnr=0", opts) -- show diagnostics for file - - opts.desc = "Show line diagnostics" - keymap.set("n", "d", vim.diagnostic.open_float, opts) -- show diagnostics for line - - opts.desc = "Go to previous diagnostic" - keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer - - opts.desc = "Go to next diagnostic" - keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer - - opts.desc = "Show documentation for what is under cursor" - keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor - - opts.desc = "Restart LSP" - keymap.set("n", "rs", ":LspRestart", opts) -- mapping to restart lsp if necessary - end, -}) - --- used to enable autocompletion (assign to every lsp server config) -local capabilities = cmp_nvim_lsp.default_capabilities() - --- Change the Diagnostic symbols in the sign column (gutter) --- (not in youtube nvim video) -local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " } -for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) -end - -mason_lspconfig.setup_handlers({ - -- default handler for installed servers - function(server_name) - lspconfig[server_name].setup({ - capabilities = capabilities, - }) - end, - ["svelte"] = function() - -- configure svelte server - lspconfig["svelte"].setup({ - capabilities = capabilities, - on_attach = function(client, bufnr) - vim.api.nvim_create_autocmd("BufWritePost", { - pattern = { "*.js", "*.ts" }, - callback = function(ctx) - -- Here use ctx.match instead of ctx.file - client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match }) - end, - }) - end, - }) - end, - ["graphql"] = function() - -- configure graphql language server - lspconfig["graphql"].setup({ - capabilities = capabilities, - filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" }, - }) - end, - ["emmet_ls"] = function() - -- configure emmet language server - lspconfig["emmet_ls"].setup({ - capabilities = capabilities, - filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, - }) - end, - ["lua_ls"] = function() - -- configure lua server (with special settings) - lspconfig["lua_ls"].setup({ - capabilities = capabilities, - settings = { - Lua = { - -- make the language server recognize "vim" global - diagnostics = { - globals = { "vim" }, - }, - completion = { - callSnippet = "Replace", - }, - }, - }, - }) - end, -}) +require'lspconfig'.pyright.setup{} +require'lspconfig'.nil_ls.setup{} +require'lspconfig'.marksman.setup{} +require'lspconfig'.rust_analyzer.setup{} +require'lspconfig'.yamlls.setup{} +require'lspconfig'.bashls.setup{} diff --git a/config/nvim/plugins/mason.lua b/config/nvim/plugins/mason.lua deleted file mode 100644 index c25467b..0000000 --- a/config/nvim/plugins/mason.lua +++ /dev/null @@ -1,43 +0,0 @@ -local mason = require("mason") - --- import mason-lspconfig -local mason_lspconfig = require("mason-lspconfig") - --- enable mason and configure icons -mason.setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", - }, - }, -}) - -mason_lspconfig.setup({ - -- list of servers for mason to install - ensure_installed = { - "bashls", - "docker", - "docker_compose_language_service", - "gopls", - "jsonls", - "markdown_oxide", - "taplo", - "tailwindcss", - "yamlls", - "rnix", - "rust_analyzer", - "sqlls", - "tsserver", - "html", - "cssls", - "tailwindcss", - "svelte", - "lua_ls", - "graphql", - "emmet_ls", - "prismals", - "pyright", - }, -}) diff --git a/hosts/familypc/home.nix b/hosts/familypc/home.nix index 0cd34cd..d064c19 100644 --- a/hosts/familypc/home.nix +++ b/hosts/familypc/home.nix @@ -182,7 +182,16 @@ in withNodeJs = true; extraPackages = with pkgs; [ lua-language-server - go + gopls + xclip + wl-clipboard + luajitPackages.lua-lsp + nil + rust-analyzer + nodePackages.bash-language-server + yaml-language-server + pyright + marksman ]; plugins = with pkgs.vimPlugins; [ alpha-nvim @@ -217,8 +226,6 @@ in nvim-tree-lua telescope-fzf-native-nvim vim-tmux-navigator - mason-nvim - mason-lspconfig-nvim ]; extraLuaConfig = '' ${builtins.readFile ../../config/nvim/options.lua} @@ -230,7 +237,6 @@ in ${builtins.readFile ../../config/nvim/plugins/cmp.lua} ${builtins.readFile ../../config/nvim/plugins/lsp.lua} ${builtins.readFile ../../config/nvim/plugins/nvim-tree.lua} - ${builtins.readFile ../../config/nvim/plugins/mason.lua} ${builtins.readFile ../../config/nvim/plugins/telescope.lua} ${builtins.readFile ../../config/nvim/plugins/todo-comments.lua} ${builtins.readFile ../../config/nvim/plugins/treesitter.lua}