From 546b3ffb96c8f84a31f3b77ab71c7c87d311dd78 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Wed, 11 Jun 2025 11:58:37 +0200 Subject: [PATCH] feat: LSP improvements --- lua/weeheavy/plugins/lsp/blink.lua | 1 - lua/weeheavy/plugins/lsp/nvim-lint.lua | 27 ++++++++++++++++++++++---- lua/weeheavy/plugins/lualine.lua | 17 +++++++++++++++- lua/weeheavy/plugins/treesitter.lua | 2 ++ lua/weeheavy/prefs.lua | 1 + 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/lua/weeheavy/plugins/lsp/blink.lua b/lua/weeheavy/plugins/lsp/blink.lua index ca1fd60..2fa9599 100644 --- a/lua/weeheavy/plugins/lsp/blink.lua +++ b/lua/weeheavy/plugins/lsp/blink.lua @@ -35,7 +35,6 @@ return { [""] = { "cancel", "fallback" }, [""] = { "scroll_documentation_down" }, [""] = { "scroll_documentation_up" }, - [""] = { "show" }, }, appearance = { -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' diff --git a/lua/weeheavy/plugins/lsp/nvim-lint.lua b/lua/weeheavy/plugins/lsp/nvim-lint.lua index 2cba92b..bb679d1 100644 --- a/lua/weeheavy/plugins/lsp/nvim-lint.lua +++ b/lua/weeheavy/plugins/lsp/nvim-lint.lua @@ -1,7 +1,24 @@ +-- You can see which linters are running with require("lint").get_running() return { "mfussenegger/nvim-lint", - -- event = { "BufReadPre", "BufNewFile" }, event = "VeryLazy", + opts = { + -- other config + linters = { + eslint_d = { + args = { + "--no-warn-ignored", -- <-- this is the key argument + "--format", + "json", + "--stdin", + "--stdin-filename", + function() + return vim.api.nvim_buf_get_name(0) + end, + }, + }, + }, + }, config = function() local lint = require("lint") @@ -12,16 +29,18 @@ return { typescriptreact = { "eslint_d" }, svelte = { "eslint_d" }, python = { "ruff" }, + lua = { "woke" }, ansible = { "woke" }, markdown = { "woke", "proselint" }, text = { "woke" }, sh = { "woke" }, + go = { "golangcilint" }, } - -- local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) + local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) vim.api.nvim_create_autocmd({ "BufEnter", "BufReadPost", "BufWritePost", "InsertLeave" }, { - -- group = lint_augroup, + group = lint_augroup, callback = function() lint.try_lint() end, @@ -29,6 +48,6 @@ return { vim.keymap.set("n", "l", function() lint.try_lint() - end, { desc = "Trigger linting for current file" }) + end, { desc = "Lint current file" }) end, } diff --git a/lua/weeheavy/plugins/lualine.lua b/lua/weeheavy/plugins/lualine.lua index dcd9b10..d37ba36 100644 --- a/lua/weeheavy/plugins/lualine.lua +++ b/lua/weeheavy/plugins/lualine.lua @@ -1,5 +1,16 @@ -- status line like vim-airline +-- Show attached linter +local linter_name = function() + -- local linters = require("lint").get_running() + local filetype = vim.bo.filetype + local linters = require("lint").linters_by_ft[filetype] + if #linters == 0 then + return "󰦕" + end + return "󱉶 " .. table.concat(linters, ",") +end + -- Display attached LSP client local function lsp_client_name() -- local bufnr = vim.api.nvim_get_current_buf() @@ -15,7 +26,8 @@ local function lsp_client_name() table.insert(c, client.name) -- table.insert(c, string.sub(client.name, 0, 8) .. "...") end - return "\u{f085} " .. table.concat(c, ",") + -- return "\u{f085} " .. table.concat(c, ",") + return "\u{f286} " .. table.concat(c, ",") end -- hide content on narrow windows @@ -71,7 +83,10 @@ return { { "encoding", cond = hide_in_width }, { "fileformat", cond = hide_in_width }, { "filetype" }, + -- custom shit + -- { "aerial" }, { lsp_client_name, cond = hide_in_width }, + { linter_name, cond = hide_in_width }, --{ clock, cond = hide_in_width }, function() local ok, pomo = pcall(require, "pomo") diff --git a/lua/weeheavy/plugins/treesitter.lua b/lua/weeheavy/plugins/treesitter.lua index cc3fd3e..84e951f 100644 --- a/lua/weeheavy/plugins/treesitter.lua +++ b/lua/weeheavy/plugins/treesitter.lua @@ -1,6 +1,8 @@ -- Treesitter return { "nvim-treesitter/nvim-treesitter", + branch = "master", -- FIXME: switch to main sometime + lazy = false, build = ":TSUpdate", event = { "BufReadPre", "BufNewFile" }, enabled = true, diff --git a/lua/weeheavy/prefs.lua b/lua/weeheavy/prefs.lua index 71aa381..09f8651 100644 --- a/lua/weeheavy/prefs.lua +++ b/lua/weeheavy/prefs.lua @@ -119,6 +119,7 @@ vim.diagnostic.config({ }, virtual_text = true, virtual_lines = false, + update_in_insert = true, -- potential perf problem? jump = { float = true, },