feat: LSP improvements
This commit is contained in:
parent
ed218ba13c
commit
546b3ffb96
5 changed files with 42 additions and 6 deletions
|
|
@ -35,7 +35,6 @@ return {
|
|||
["<C-c>"] = { "cancel", "fallback" },
|
||||
["<C-n>"] = { "scroll_documentation_down" },
|
||||
["<C-p>"] = { "scroll_documentation_up" },
|
||||
["<C-s>"] = { "show" },
|
||||
},
|
||||
appearance = {
|
||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||
|
|
|
|||
|
|
@ -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", "<leader>l", function()
|
||||
lint.try_lint()
|
||||
end, { desc = "Trigger linting for current file" })
|
||||
end, { desc = "Lint current file" })
|
||||
end,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ vim.diagnostic.config({
|
|||
},
|
||||
virtual_text = true,
|
||||
virtual_lines = false,
|
||||
update_in_insert = true, -- potential perf problem?
|
||||
jump = {
|
||||
float = true,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue