From ab603072b98e01594adfaf4338bcd62bb40d39f3 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Sat, 20 Jan 2024 16:22:40 +0100 Subject: [PATCH] lsp stuff --- lua/custom/configs/lspconfig.lua | 11 +++++++++- lua/custom/configs/overrides.lua | 9 ++++++-- lua/custom/plugins.lua | 35 +++++++++++++++++++++++++------- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/lua/custom/configs/lspconfig.lua b/lua/custom/configs/lspconfig.lua index 7070a8e..fad87e4 100644 --- a/lua/custom/configs/lspconfig.lua +++ b/lua/custom/configs/lspconfig.lua @@ -4,7 +4,16 @@ local capabilities = require("plugins.configs.lspconfig").capabilities local lspconfig = require "lspconfig" -- if you just want default config for the servers then put them in a table -local servers = { "html", "cssls", "tsserver", "clangd", "pyright", "rust_analyzer" } +local servers = { + "html", + "cssls", + "tsserver", + "clangd", + "pyright", + "rust_analyzer", + "bashls", + "cmake", +} for _, lsp in ipairs(servers) do lspconfig[lsp].setup { diff --git a/lua/custom/configs/overrides.lua b/lua/custom/configs/overrides.lua index 3c2d3e6..713113d 100644 --- a/lua/custom/configs/overrides.lua +++ b/lua/custom/configs/overrides.lua @@ -18,6 +18,7 @@ M.treesitter = { "yaml", "json", "toml", + "bash", }, indent = { enable = true, @@ -46,6 +47,7 @@ M.mason = { -- c/cpp stuff "clangd", "clang-format", + "cmake-language-server", -- rust "rust-analyzer", @@ -54,9 +56,12 @@ M.mason = { -- python "pyright", - -- english?? - "write-good" + "write-good", + + -- shell + "shellcheck", + "bash-language-server", }, } diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua index b0ed7e9..e175b15 100644 --- a/lua/custom/plugins.lua +++ b/lua/custom/plugins.lua @@ -562,15 +562,35 @@ local plugins = { }, { "nvimtools/none-ls.nvim", - optional = true, + event = { "BufReadPre", "BufNewFile" }, opts = function(_, opts) + opts.sources = {} local nls = require "null-ls" - local source = nls.builtins.diagnostics.write_good.with { - diagnostics_postprocess = function(diagnostic) - diagnostic.severity = vim.diagnostic.severity.HINT - end, + local builtins = nls.builtins + local sources = { + builtins.formatting.stylua, + builtins.formatting.black, + builtins.formatting.fixjson, + builtins.formatting.golines, + builtins.formatting.markdownlint, + builtins.formatting.shellharden, + builtins.formatting.sql_formatter, + builtins.formatting.taplo, + builtins.diagnostics.markdownlint, + builtins.diagnostics.mypy, + builtins.diagnostics.vint, + builtins.diagnostics.yamllint, + builtins.code_actions.shellcheck, + builtins.formatting.shfmt, + builtins.diagnostics.write_good.with { + diagnostics_postprocess = function(diagnostic) + diagnostic.severity = vim.diagnostic.severity.HINT + end, + }, } - table.insert(opts.sources, source) + for _, source in ipairs(sources) do + table.insert(opts.sources, source) + end end, }, { @@ -601,9 +621,10 @@ local plugins = { end, }) -- change how the highlighting looks - vim.cmd("hi LspInlayHint guibg=bg guifg=#804d66") + vim.cmd "hi LspInlayHint guibg=bg guifg=#804d66" end, }, + { "kosayoda/nvim-lightbulb", event = { "BufReadPre", "BufNewFile" } }, } return plugins