From 8ec18a224fa7a9a2a7f3233c0b0be43917e9eed6 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Wed, 20 Nov 2024 19:57:28 +0200 Subject: Added back most of the LSPs --- .../nvim/lua/custom/config/language-servers.lua | 106 ++++++++++----------- .config/nvim/lua/custom/plugins/conform.lua | 24 ++--- .config/nvim/lua/custom/plugins/mason.lua | 14 +-- .config/nvim/lua/custom/plugins/nvim-lint.lua | 78 +++++++-------- 4 files changed, 111 insertions(+), 111 deletions(-) (limited to '.config/nvim/lua/custom') diff --git a/.config/nvim/lua/custom/config/language-servers.lua b/.config/nvim/lua/custom/config/language-servers.lua index 0f07d95..4163628 100644 --- a/.config/nvim/lua/custom/config/language-servers.lua +++ b/.config/nvim/lua/custom/config/language-servers.lua @@ -55,61 +55,61 @@ return { -- }, -- }, -- }, -- python - -- bashls = true, -- bash - -- taplo = true, -- toml - -- lemminx = true, -- xml - -- yamlls = true, -- yaml - -- jsonls = true, -- json - -- html = true, -- html - -- cssls = true, -- css - -- ts_ls = true, -- javascript/typescript - -- astro = true, -- astro framework - -- mdx_analyzer = true, -- markdown with JS I think + bashls = true, -- bash + taplo = true, -- toml + lemminx = true, -- xml + yamlls = true, -- yaml + jsonls = true, -- json + html = true, -- html + cssls = true, -- css + ts_ls = true, -- javascript/typescript + astro = true, -- astro framework + mdx_analyzer = true, -- markdown with JS I think -- marksman = true, -- Markdown LSP -- markdown_oxide = true, -- Markdown LSP but better - -- gopls = { - -- cmd = { 'gopls' }, - -- filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, - -- root_dir = function(filename) - -- return require('lspconfig/util').root_pattern('go.work', 'go.mod', '.git')(filename) - -- end, - -- settings = { - -- gopls = { - -- gofumpt = true, - -- codelenses = { - -- gc_details = false, - -- generate = true, - -- regenerate_cgo = true, - -- run_govulncheck = true, - -- test = true, - -- tidy = true, - -- upgrade_dependency = true, - -- vendor = true, - -- }, - -- hints = { - -- assignVariableTypes = false, - -- compositeLiteralFields = false, - -- compositeLiteralTypes = true, - -- constantValues = true, - -- functionTypeParameters = false, - -- parameterNames = false, - -- rangeVariableTypes = true, - -- }, - -- analyses = { - -- fieldalignment = true, - -- nilness = true, - -- unusedparams = true, - -- unusedwrite = true, - -- useany = true, - -- }, - -- usePlaceholders = false, - -- completeUnimported = true, - -- staticcheck = true, - -- directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' }, - -- semanticTokens = true, - -- }, - -- }, - -- }, -- Go LSP + gopls = { + cmd = { 'gopls' }, + filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, + root_dir = function(filename) + return require('lspconfig/util').root_pattern('go.work', 'go.mod', '.git')(filename) + end, + settings = { + gopls = { + gofumpt = true, + codelenses = { + gc_details = false, + generate = true, + regenerate_cgo = true, + run_govulncheck = true, + test = true, + tidy = true, + upgrade_dependency = true, + vendor = true, + }, + hints = { + assignVariableTypes = false, + compositeLiteralFields = false, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = false, + parameterNames = false, + rangeVariableTypes = true, + }, + analyses = { + fieldalignment = true, + nilness = true, + unusedparams = true, + unusedwrite = true, + useany = true, + }, + usePlaceholders = false, + completeUnimported = true, + staticcheck = true, + directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' }, + semanticTokens = true, + }, + }, + }, -- Go LSP -- jdtls = true, -- java -- sqlls = true, -- sqls = { diff --git a/.config/nvim/lua/custom/plugins/conform.lua b/.config/nvim/lua/custom/plugins/conform.lua index 973e5dc..2610884 100644 --- a/.config/nvim/lua/custom/plugins/conform.lua +++ b/.config/nvim/lua/custom/plugins/conform.lua @@ -3,27 +3,27 @@ return { event = { 'BufWritePre' }, cmd = { 'ConformInfo' }, keys = { - { 'ft', 'FormatToggle', desc = '[F]ormat [T]oggle Globally' }, + { 'ft', 'FormatToggle', desc = '[F]ormat [T]oggle Globally' }, { 'fT', 'FormatToggle!', desc = '[F]ormat [T]oggle Locally' }, - { 'ff', 'Format', desc = '[F]ormat [F]ile' }, - { 'f', 'Format', desc = '[F]ormat', mode = 'v' }, + { 'ff', 'Format', desc = '[F]ormat [F]ile' }, + { 'f', 'Format', desc = '[F]ormat', mode = 'v' }, }, ---@module "conform" ---@type conform.setupOpts opts = { formatters_by_ft = { - -- ['lua'] = { 'stylua' }, + ['lua'] = { 'stylua' }, -- ['c'] = { 'clang-format' }, -- ['python'] = { 'isort', 'black' }, -- ['rust'] = { 'rustfmt' }, - -- ['go'] = { 'gofumpt', 'goimports-reviser' }, - -- ['markdown'] = { 'prettierd', 'prettier', stop_after_first = true }, - -- ['yaml'] = { 'prettierd' }, - -- ['json'] = { 'jq' }, - -- ['html'] = { 'prettierd', 'prettier', stop_after_first = true }, - -- ['css'] = { 'prettierd', 'prettier', stop_after_first = true }, - -- ['javascript'] = { 'prettierd', 'prettier', stop_after_first = true }, - -- ['typescript'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['go'] = { 'gofumpt', 'goimports-reviser' }, + ['markdown'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['yaml'] = { 'prettierd' }, + ['json'] = { 'jq' }, + ['html'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['css'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['javascript'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['typescript'] = { 'prettierd', 'prettier', stop_after_first = true }, }, format_on_save = function(bufnr) -- Disable with a global or buffer local variable diff --git a/.config/nvim/lua/custom/plugins/mason.lua b/.config/nvim/lua/custom/plugins/mason.lua index ca4cb32..c42ebc0 100644 --- a/.config/nvim/lua/custom/plugins/mason.lua +++ b/.config/nvim/lua/custom/plugins/mason.lua @@ -24,14 +24,14 @@ return { -- 'black', -- python formatter -- 'isort', -- python formatter for imports -- 'flake8', -- python linter - -- 'gofumpt', -- go formatter + 'gofumpt', -- go formatter -- 'golangci-lint', -- go linter - -- 'prettierd', -- multi-lang formatter - -- 'prettier', -- prettierd but slower, used as a fallback - -- 'jq', -- json formatter - -- 'jsonlint', -- json linter - -- 'shellcheck', -- bash linter - -- 'beautysh', -- shell formatter + 'prettierd', -- multi-lang formatter + 'prettier', -- prettierd but slower, used as a fallback + 'jq', -- json formatter + 'jsonlint', -- json linter + 'shellcheck', -- bash linter + 'beautysh', -- shell formatter }, }, }, diff --git a/.config/nvim/lua/custom/plugins/nvim-lint.lua b/.config/nvim/lua/custom/plugins/nvim-lint.lua index b9b0316..7bb3a16 100644 --- a/.config/nvim/lua/custom/plugins/nvim-lint.lua +++ b/.config/nvim/lua/custom/plugins/nvim-lint.lua @@ -1,41 +1,41 @@ return { - -- 'mfussenegger/nvim-lint', - -- lazy = false, - -- config = function() - -- local lint = require('lint') - -- lint.linters_by_ft = { - -- c = { 'clangtidy' }, - -- cpp = { 'clangtidy' }, - -- go = { 'golangcilint' }, - -- python = { 'flake8' }, - -- json = { 'jsonlint' }, - -- bash = { 'shellcheck' }, - -- } - -- - -- vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave', 'TextChanged', 'TextChangedI' }, { - -- group = vim.api.nvim_create_augroup('nvim-lint', { clear = true }), - -- callback = function() - -- require('lint').try_lint() - -- end, - -- }) - -- - -- -- NOTE: most if not all of clangt-idy warnings are - -- -- also reported by clangd, so this function filters clang-tidy warnings - -- -- to avoid duplication of warnings - -- local clangtidy_parser = lint.linters.clangtidy.parser - -- lint.linters.clangtidy.parser = function(output, bufnr, linter_cwd) - -- local diagnostics = clangtidy_parser(output, bufnr, linter_cwd) - -- diagnostics = vim.tbl_filter(function(diagnostic) - -- if diagnostic.severity == vim.diagnostic.severity.WARN then - -- return false - -- end - -- if diagnostic.severity == vim.diagnostic.severity.ERROR then - -- return false - -- end - -- - -- return true - -- end, diagnostics) - -- return diagnostics - -- end - -- end, + 'mfussenegger/nvim-lint', + lazy = false, + config = function() + local lint = require('lint') + lint.linters_by_ft = { + -- c = { 'clangtidy' }, + -- cpp = { 'clangtidy' }, + go = { 'golangcilint' }, + -- python = { 'flake8' }, + json = { 'jsonlint' }, + bash = { 'shellcheck' }, + } + + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave', 'TextChanged', 'TextChangedI' }, { + group = vim.api.nvim_create_augroup('nvim-lint', { clear = true }), + callback = function() + require('lint').try_lint() + end, + }) + + -- NOTE: most if not all of clangt-idy warnings are + -- also reported by clangd, so this function filters clang-tidy warnings + -- to avoid duplication of warnings + -- local clangtidy_parser = lint.linters.clangtidy.parser + -- lint.linters.clangtidy.parser = function(output, bufnr, linter_cwd) + -- local diagnostics = clangtidy_parser(output, bufnr, linter_cwd) + -- diagnostics = vim.tbl_filter(function(diagnostic) + -- if diagnostic.severity == vim.diagnostic.severity.WARN then + -- return false + -- end + -- if diagnostic.severity == vim.diagnostic.severity.ERROR then + -- return false + -- end + -- + -- return true + -- end, diagnostics) + -- return diagnostics + -- end + end, } -- cgit v1.3.1