diff --git a/common/.config/nvim/init.lua b/common/.config/nvim/init.lua index 157fec5..4dafe77 100644 --- a/common/.config/nvim/init.lua +++ b/common/.config/nvim/init.lua @@ -9,42 +9,10 @@ -- Copy visual section to a line number -> :'<,'>t15 (copies To line 15) -- Load keymaps & options -require("config") - --- `:help lazy.nvim.txt` for more info -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "--branch=stable", - lazyrepo, - lazypath, - }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end - ----@diagnostic disable-next-line: undefined-field -vim.opt.rtp:prepend(lazypath) - --- You can also configure plugins after the setup call, --- as they will be available in your neovim runtime. -require("lazy").setup({ - change_detection = { - notify = false, - }, - build = { - warn_on_override = true, - }, - spec = { { import = "plugins" } }, -}) +-- Order matters +require("config.options") +require("config.keymaps") +require("core.lazy") +require("core.lsp") +require("config.filetype-based-keymaps") +require("config.autocmd") diff --git a/common/.config/nvim/lsp/bashls.lua b/common/.config/nvim/lsp/bashls.lua new file mode 100644 index 0000000..f068a52 --- /dev/null +++ b/common/.config/nvim/lsp/bashls.lua @@ -0,0 +1,3 @@ +return { + filetypes = { "sh", "bash", "zsh" }, +} diff --git a/common/.config/nvim/lsp/cssls.lua b/common/.config/nvim/lsp/cssls.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/common/.config/nvim/lsp/cssls.lua @@ -0,0 +1 @@ +return {} diff --git a/common/.config/nvim/lsp/docker_compose_language_service.lua b/common/.config/nvim/lsp/docker_compose_language_service.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/common/.config/nvim/lsp/docker_compose_language_service.lua @@ -0,0 +1 @@ +return {} diff --git a/common/.config/nvim/lsp/dockerls.lua b/common/.config/nvim/lsp/dockerls.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/common/.config/nvim/lsp/dockerls.lua @@ -0,0 +1 @@ +return {} diff --git a/common/.config/nvim/lsp/html.lua b/common/.config/nvim/lsp/html.lua new file mode 100644 index 0000000..ebcaaa4 --- /dev/null +++ b/common/.config/nvim/lsp/html.lua @@ -0,0 +1,6 @@ +return { + -- cmd = { ... }, + -- filetypes = { ... }, + -- capabilities = {}, + filetypes = { "html", "twig", "hbs" }, +} diff --git a/common/.config/nvim/lsp/jsonls.lua b/common/.config/nvim/lsp/jsonls.lua new file mode 100644 index 0000000..e2e69ef --- /dev/null +++ b/common/.config/nvim/lsp/jsonls.lua @@ -0,0 +1,15 @@ +return { + -- lazy-load schemastore when needed + on_new_config = function(new_config) + new_config.settings.json.schemas = new_config.settings.json.schemas or {} + vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas()) + end, + settings = { + json = { + format = { + enable = true, + }, + validate = { enable = true }, + }, + }, +} diff --git a/common/.config/nvim/lsp/lua_ls.lua b/common/.config/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..30e9298 --- /dev/null +++ b/common/.config/nvim/lsp/lua_ls.lua @@ -0,0 +1,28 @@ +return { + settings = { + typescript = { + updateImportOnFileMove = { enabled = "always" }, + suggest = { completeFunctionCalls = true }, + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + }, +} diff --git a/common/.config/nvim/lsp/omnisharp.lua b/common/.config/nvim/lsp/omnisharp.lua new file mode 100644 index 0000000..dc3c95b --- /dev/null +++ b/common/.config/nvim/lsp/omnisharp.lua @@ -0,0 +1,32 @@ +return { + cmd = { "omnisharp" }, + handlers = { + ["textDocument/definition"] = function(...) + return require("omnisharp_extended").handler(...) + end, + }, + enable_roslyn_analyzers = true, + organize_imports_on_format = true, + enable_import_completion = true, + enable_editorconfig_support = true, + enable_ms_build_load_projects_on_demand = false, + analyze_open_documents_only = false, + settings = { + dotnet = { + server = { + useOmnisharpServer = true, + useModernNet = true, + }, + }, + csharp = { + inlayHints = { + parameters = { + enabled = true, + }, + types = { + enabled = true, + }, + }, + }, + }, +} diff --git a/common/.config/nvim/lsp/pylsp.lua b/common/.config/nvim/lsp/pylsp.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/common/.config/nvim/lsp/pylsp.lua @@ -0,0 +1 @@ +return {} diff --git a/common/.config/nvim/lsp/rust_analyzer.lua b/common/.config/nvim/lsp/rust_analyzer.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/common/.config/nvim/lsp/rust_analyzer.lua @@ -0,0 +1 @@ +return {} diff --git a/common/.config/nvim/lsp/sqlls.lua b/common/.config/nvim/lsp/sqlls.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/common/.config/nvim/lsp/sqlls.lua @@ -0,0 +1 @@ +return {} diff --git a/common/.config/nvim/lsp/ts_ls.lua b/common/.config/nvim/lsp/ts_ls.lua new file mode 100644 index 0000000..30e9298 --- /dev/null +++ b/common/.config/nvim/lsp/ts_ls.lua @@ -0,0 +1,28 @@ +return { + settings = { + typescript = { + updateImportOnFileMove = { enabled = "always" }, + suggest = { completeFunctionCalls = true }, + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + }, +} diff --git a/common/.config/nvim/lua/config/init.lua b/common/.config/nvim/lua/config/init.lua deleted file mode 100644 index 6377e40..0000000 --- a/common/.config/nvim/lua/config/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -require("config.keymaps") -require("config.options") -require("config.autocmd") -require("config.filetype-based-keymaps") -require("config.vim_plugin_config") diff --git a/common/.config/nvim/lua/config/util.lua b/common/.config/nvim/lua/config/util.lua index 1e79df0..621edd7 100644 --- a/common/.config/nvim/lua/config/util.lua +++ b/common/.config/nvim/lua/config/util.lua @@ -12,7 +12,7 @@ local M = { BreakpointRejected = { " ", "DiagnosticError" }, LogPoint = ".>", }, - diagnostics = { Error = " ", Warn = " ", Hint = " ", Info = " " }, + diagnostics = { ERROR = " ", WARN = " ", HINT = " ", INFO = " " }, git = { added = " ", modified = " ", removed = " " }, kinds = { Array = " ", diff --git a/common/.config/nvim/lua/config/vim_plugin_config.lua b/common/.config/nvim/lua/config/vim_plugin_config.lua deleted file mode 100644 index d447a12..0000000 --- a/common/.config/nvim/lua/config/vim_plugin_config.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Load Plugin configs from VIM -local vim_plugin_config = os.getenv("HOME") .. "/.vim/plugin_config.vim" -if vim.loop.fs_stat(vim_plugin_config) then - vim.cmd("source " .. vim_plugin_config) -end diff --git a/common/.config/nvim/lua/core/lazy.lua b/common/.config/nvim/lua/core/lazy.lua new file mode 100644 index 0000000..53cd42f --- /dev/null +++ b/common/.config/nvim/lua/core/lazy.lua @@ -0,0 +1,37 @@ +-- `:help lazy.nvim.txt` for more info +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "--branch=stable", + lazyrepo, + lazypath, + }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end + +---@diagnostic disable-next-line: undefined-field +vim.opt.rtp:prepend(lazypath) + +-- You can also configure plugins after the setup call, +-- as they will be available in your neovim runtime. +require("lazy").setup({ + change_detection = { + notify = false, + }, + build = { + warn_on_override = true, + }, + spec = { { import = "plugins" } }, +}) diff --git a/common/.config/nvim/lua/core/lsp.lua b/common/.config/nvim/lua/core/lsp.lua new file mode 100644 index 0000000..96254da --- /dev/null +++ b/common/.config/nvim/lua/core/lsp.lua @@ -0,0 +1,134 @@ +vim.lsp.enable({ + "bashls", + "cssls", + "docker_compose_language_service", + "dockerls", + "html", + "jsonls", + "lua_ls", + "omnisharp", + "pylsp", + "rust_analyzer", + "sqlls", + "ts_ls", + -- TODO: Enable inlay_hints for all of them +}) + +-- TIP: On new systems, install these through Mason +---@diagnostic disable-next-line: unused-local +local to_installed = vim.tbl_keys({ + "black", -- Python formatter + "csharpier", -- C# formatter + "djlint", -- Handlebar Formatter + "markdown-toc", + "markdownlint", + "netcoredbg", -- C# Debugger + "prettier", + "prettierd", + "shellharden", + "shfmt", + "stylua", + "trivy", -- Vulnerability Linter + "yamlfmt", +}) + +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), + callback = function(event) + local client = vim.lsp.get_client_by_id(event.data.client_id) + + -- Setup LSP completion + -- This is already done by blink, but better prefer the builtin one + if client:supports_method("textDocument/completion") then + vim.opt.completeopt = { "menu", "menuone", "noinsert", "fuzzy", "popup" } + vim.lsp.completion.enable(true, client.id, event.buf, { autotrigger = true }) + vim.keymap.set("i", "", function() + vim.lsp.completion.get() + end) + end + + local map = function(keys, func, desc, mode) + mode = mode or "n" + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) + end + + map("", vim.lsp.buf.rename, "Rename Symbol") + map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") + map("nf", function() + vim.fn.setreg("+", vim.fn.expand("%:p")) + print("Copied: " .. vim.fn.expand("%:p") .. " to + register") + end, "Copy current [F]ile path to register") + + -- LspSaga + map("", "Lspsaga code_action", "Code Actions") + map("cr", "Lspsaga finder", "Goto References") + map("cpf", "Lspsaga peek_definition", "Peek definition: Function") + map("cpt", "Lspsaga peek_type_definition", "Peek definition: Class") + map("cpi", "Lspsaga finder imp", "Peek: Implementations") + -- e to jump to the symbol under cursor; q to quit + map("co", "Lspsaga outline", "Outline Panel on Left") + + -- Telescope + map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation") + map("cs", require("telescope.builtin").lsp_document_symbols, "Search Document Symbols") + map("cS", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Search Workspace Symbols") + map("ct", require("telescope.builtin").lsp_type_definitions, "Goto Type Definition") + map("cd", require("telescope.builtin").diagnostics, "List Diagnostics") + + -- The following two autocommands are used to highlight references of the + -- word under cursor when cursor rests there for a little while. + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then + local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd("LspDetach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf }) + end, + }) + end + + -- Native lsp inline virtual text / inlay hints + if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then + vim.lsp.inlay_hint.enable() -- enabled by default + + map("cI", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) + end, "Toggle Inlay Hints") + end + end, +}) + +-- Change diagnostic symbols in the sign column (gutter) +if vim.g.have_nerd_font then + local signs = require("config.util").icons.diagnostics + local diagnostic_signs = {} + for type, icon in pairs(signs) do + diagnostic_signs[vim.diagnostic.severity[type]] = icon + end + vim.diagnostic.config({ signs = { text = diagnostic_signs } }) +end + +vim.diagnostic.config({ + virtual_text = { + enabled = true, + spacing = 5, + severity = { min = vim.diagnostic.severity.ERROR }, + }, + virtual_lines = { + current_line = true, + severity = { min = vim.diagnostic.severity.INFO }, + }, +}) diff --git a/common/.config/nvim/lua/plugins/code-lsp.lua b/common/.config/nvim/lua/plugins/code-lsp.lua index 3e9241d..20e31dd 100644 --- a/common/.config/nvim/lua/plugins/code-lsp.lua +++ b/common/.config/nvim/lua/plugins/code-lsp.lua @@ -1,278 +1,29 @@ return { { - -- Main LSP Configuration "neovim/nvim-lspconfig", cond = require("config.util").is_not_vscode(), dependencies = { { "williamboman/mason.nvim", config = true }, -- NOTE: Must be loaded before dependants "williamboman/mason-lspconfig.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", - - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { "j-hui/fidget.nvim", opts = {} }, - "saghen/blink.cmp", }, config = function() - -- Every time a new file is opened that is associated with - -- an lsp this function will be executed to configure the current buffer - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), - callback = function(event) - local map = function(keys, func, desc, mode) - mode = mode or "n" - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) - end - - -- Lspsaga Keymaps - -- Hover Documentation - -- Press K 2 times to jump into the hover window - -- Place cursor on "View Documentation" gx -> Open the docs on browser - map("K", "Lspsaga hover_doc", "Hover Documentation") - map("", vim.lsp.buf.rename, "Rename Symbol") - - map("", "Lspsaga code_action", "Code Actions") - map("ca", "Lspsaga code_action", "Code Actions") - - map("cr", "Lspsaga finder", "Goto References") - - map("cpf", "Lspsaga peek_definition", "Peek definition: Function") - map("cpt", "Lspsaga peek_type_definition", "Peek definition: Class") - map("cpi", "Lspsaga finder imp", "Peek: Implementations") - - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") - map("", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") - - map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") - - map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation") - map("ci", require("telescope.builtin").lsp_implementations, "Goto Implementation") - - map("cs", require("telescope.builtin").lsp_document_symbols, "Search Document Symbols") - map("cS", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Search Workspace Symbols") - - map("ct", require("telescope.builtin").lsp_type_definitions, "Goto Type Definition") - -- e to jump to the symbol under cursor; q to quit - map("co", "Lspsaga outline", "Outline Panel on Left") - - map("cd", require("telescope.builtin").diagnostics, "List Diagnostics") - - map("nf", function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, "Workspace Folders on Notification") - - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- When you move your cursor, the highlights will be cleared - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then - local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd("LspDetach", { - group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf }) - end, - }) - end - - -- Native lsp inline virtual text / inlay hints - if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then - vim.lsp.inlay_hint.enable() -- enabled by default - - map("cI", function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) - end, "Toggle Inlay Hints") - end - end, - }) - - -- Change diagnostic symbols in the sign column (gutter) - if vim.g.have_nerd_font then - local signs = { ERROR = "", WARN = "", INFO = "", HINT = "" } - local diagnostic_signs = {} - for type, icon in pairs(signs) do - diagnostic_signs[vim.diagnostic.severity[type]] = icon - end - vim.diagnostic.config({ signs = { text = diagnostic_signs } }) - end - - -- Enable the following language servers - -- Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - local servers = { - html = { - -- cmd = { ... }, - -- filetypes = { ... }, - -- capabilities = {}, - filetypes = { "html", "twig", "hbs" }, - }, - cssls = {}, - jsonls = { - -- lazy-load schemastore when needed - on_new_config = function(new_config) - new_config.settings.json.schemas = new_config.settings.json.schemas or {} - vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas()) - end, - settings = { - json = { - format = { - enable = true, - }, - validate = { enable = true }, - }, - }, - }, - - bashls = { filetypes = { "sh", "bash", "zsh" } }, - pylsp = {}, - lua_ls = { - settings = { - Lua = { - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - completion = { callSnippet = "Replace" }, - hint = { enable = true }, - diagnostics = { disable = { "missing-fields" } }, - }, - }, - }, - omnisharp = { - cmd = { "omnisharp" }, - handlers = { - ["textDocument/definition"] = function(...) - return require("omnisharp_extended").handler(...) - end, - }, - enable_roslyn_analyzers = true, - organize_imports_on_format = true, - enable_import_completion = true, - enable_editorconfig_support = true, - enable_ms_build_load_projects_on_demand = false, - analyze_open_documents_only = false, - settings = { - dotnet = { - server = { - useOmnisharpServer = true, - useModernNet = true, - }, - }, - csharp = { - inlayHints = { - parameters = { - enabled = true, - }, - types = { - enabled = true, - }, - }, - }, - }, - }, - ts_ls = { - settings = { - typescript = { - updateImportOnFileMove = { enabled = "always" }, - suggest = { completeFunctionCalls = true }, - inlayHints = { - includeInlayParameterNameHints = "all", - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, - }, - javascript = { - inlayHints = { - includeInlayParameterNameHints = "all", - includeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayFunctionParameterTypeHints = true, - includeInlayVariableTypeHints = true, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayEnumMemberValueHints = true, - }, - }, - }, - }, - - sqlls = {}, - dockerls = {}, - docker_compose_language_service = {}, - } - - -- Ensure the servers and tools above are installed - require("mason").setup() - - -- Add completion capabilities + local servers = {} local capabilities = vim.lsp.protocol.make_client_capabilities() - -- TODO: Remove this when we get neovim 0.11 - capabilities = require("blink.cmp").get_lsp_capabilities(capabilities) - - -- Add other (other than LSP servers) tools here that you want Mason to install for you - -- Which means: formatters and debuggers - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - "black", -- Python formatter - "csharpier", -- C# formatter - "djlint", -- Handlebar Formatter - "markdown-toc", - "markdownlint", - "netcoredbg", -- C# Debugger - "prettier", - "prettierd", - "shellharden", - "shfmt", - "stylua", - "trivy", -- Vulnerability Linter - "yamlfmt", - }) - - -- TODO: Remove all installations through Mason - -- i.e. Remove mason.nvim, mason-lspconfig and mason-tool-installer - -- We should install those globally on the system - -- That would make it easier to work with on FreeBSD - require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) - - ---@diagnostic disable-next-line: missing-fields + -- NOTE: `nvim-lspconfig` has default LSP configs in its DB which saves time + -- Useful even after NeoVim 0.11, which made LSP setup much easier + -- Configs in `nvim/lsp/*` are APPENDED to each LSP setup here require("mason-lspconfig").setup({ handlers = { function(server_name) local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) server.inlay_hints = { enabled = true } server.diagnostics = { underline = true, update_in_insert = false, - virtual_text = { - spacing = 4, - source = "if_many", - prefix = "●", - }, severity_sort = true, } require("lspconfig")[server_name].setup(server) diff --git a/common/.config/nvim/lua/plugins/ui.lua b/common/.config/nvim/lua/plugins/ui.lua index 096dbcc..c9eab6b 100644 --- a/common/.config/nvim/lua/plugins/ui.lua +++ b/common/.config/nvim/lua/plugins/ui.lua @@ -252,10 +252,10 @@ return { { "diagnostics", symbols = { - error = config.icons.diagnostics.Error, - warn = config.icons.diagnostics.Warn, - info = config.icons.diagnostics.Info, - hint = config.icons.diagnostics.Hint, + error = config.icons.diagnostics.ERROR, + warn = config.icons.diagnostics.WARN, + info = config.icons.diagnostics.INFO, + hint = config.icons.diagnostics.HINT, }, }, {