Tweak LSP config
This commit is contained in:
parent
c5c9521c16
commit
77b8f9617f
@ -6,7 +6,6 @@ return {
|
||||
|
||||
lint.linters_by_ft = {
|
||||
javascript = { "eslint_d" },
|
||||
typescript = { "eslint_d" },
|
||||
svelte = { "eslint_d" },
|
||||
python = { "pylint" },
|
||||
}
|
||||
|
||||
@ -8,9 +8,6 @@ return {
|
||||
{ "folke/lazydev.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
-- import lspconfig plugin
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- import mason_lspconfig plugin
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
@ -55,10 +52,14 @@ return {
|
||||
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- show diagnostics for line
|
||||
|
||||
opts.desc = "Go to previous diagnostic"
|
||||
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer
|
||||
keymap.set("n", "[d", function()
|
||||
vim.diagnostic.jump({ count = -1, float = true })
|
||||
end, opts) -- jump to previous diagnostic in buffer
|
||||
|
||||
opts.desc = "Go to next diagnostic"
|
||||
keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer
|
||||
keymap.set("n", "]d", function()
|
||||
vim.diagnostic.jump({ count = 1, float = true })
|
||||
end, opts) -- jump to next diagnostic in buffer
|
||||
|
||||
opts.desc = "Show documentation for what is under cursor"
|
||||
keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
|
||||
@ -68,12 +69,18 @@ return {
|
||||
end,
|
||||
})
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
-- Diagnostic config
|
||||
vim.diagnostic.config({
|
||||
signs = {
|
||||
text = {
|
||||
[vim.diagnostic.severity.ERROR] = "",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.HINT] = "",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
},
|
||||
},
|
||||
virtual_text = true,
|
||||
})
|
||||
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = {
|
||||
"BufReadPre",
|
||||
@ -47,4 +48,8 @@ return {
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user