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-c>"] = { "cancel", "fallback" },
|
||||||
["<C-n>"] = { "scroll_documentation_down" },
|
["<C-n>"] = { "scroll_documentation_down" },
|
||||||
["<C-p>"] = { "scroll_documentation_up" },
|
["<C-p>"] = { "scroll_documentation_up" },
|
||||||
["<C-s>"] = { "show" },
|
|
||||||
},
|
},
|
||||||
appearance = {
|
appearance = {
|
||||||
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
-- '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 {
|
return {
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
-- event = { "BufReadPre", "BufNewFile" },
|
|
||||||
event = "VeryLazy",
|
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()
|
config = function()
|
||||||
local lint = require("lint")
|
local lint = require("lint")
|
||||||
|
|
||||||
|
|
@ -12,16 +29,18 @@ return {
|
||||||
typescriptreact = { "eslint_d" },
|
typescriptreact = { "eslint_d" },
|
||||||
svelte = { "eslint_d" },
|
svelte = { "eslint_d" },
|
||||||
python = { "ruff" },
|
python = { "ruff" },
|
||||||
|
lua = { "woke" },
|
||||||
ansible = { "woke" },
|
ansible = { "woke" },
|
||||||
markdown = { "woke", "proselint" },
|
markdown = { "woke", "proselint" },
|
||||||
text = { "woke" },
|
text = { "woke" },
|
||||||
sh = { "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" }, {
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufReadPost", "BufWritePost", "InsertLeave" }, {
|
||||||
-- group = lint_augroup,
|
group = lint_augroup,
|
||||||
callback = function()
|
callback = function()
|
||||||
lint.try_lint()
|
lint.try_lint()
|
||||||
end,
|
end,
|
||||||
|
|
@ -29,6 +48,6 @@ return {
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>l", function()
|
vim.keymap.set("n", "<leader>l", function()
|
||||||
lint.try_lint()
|
lint.try_lint()
|
||||||
end, { desc = "Trigger linting for current file" })
|
end, { desc = "Lint current file" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,16 @@
|
||||||
-- status line like vim-airline
|
-- 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
|
-- Display attached LSP client
|
||||||
local function lsp_client_name()
|
local function lsp_client_name()
|
||||||
-- local bufnr = vim.api.nvim_get_current_buf()
|
-- 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, client.name)
|
||||||
-- table.insert(c, string.sub(client.name, 0, 8) .. "...")
|
-- table.insert(c, string.sub(client.name, 0, 8) .. "...")
|
||||||
end
|
end
|
||||||
return "\u{f085} " .. table.concat(c, ",")
|
-- return "\u{f085} " .. table.concat(c, ",")
|
||||||
|
return "\u{f286} " .. table.concat(c, ",")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hide content on narrow windows
|
-- hide content on narrow windows
|
||||||
|
|
@ -71,7 +83,10 @@ return {
|
||||||
{ "encoding", cond = hide_in_width },
|
{ "encoding", cond = hide_in_width },
|
||||||
{ "fileformat", cond = hide_in_width },
|
{ "fileformat", cond = hide_in_width },
|
||||||
{ "filetype" },
|
{ "filetype" },
|
||||||
|
-- custom shit
|
||||||
|
-- { "aerial" },
|
||||||
{ lsp_client_name, cond = hide_in_width },
|
{ lsp_client_name, cond = hide_in_width },
|
||||||
|
{ linter_name, cond = hide_in_width },
|
||||||
--{ clock, cond = hide_in_width },
|
--{ clock, cond = hide_in_width },
|
||||||
function()
|
function()
|
||||||
local ok, pomo = pcall(require, "pomo")
|
local ok, pomo = pcall(require, "pomo")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
return {
|
return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
branch = "master", -- FIXME: switch to main sometime
|
||||||
|
lazy = false,
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
enabled = true,
|
enabled = true,
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ vim.diagnostic.config({
|
||||||
},
|
},
|
||||||
virtual_text = true,
|
virtual_text = true,
|
||||||
virtual_lines = false,
|
virtual_lines = false,
|
||||||
|
update_in_insert = true, -- potential perf problem?
|
||||||
jump = {
|
jump = {
|
||||||
float = true,
|
float = true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue