summaryrefslogtreecommitdiff
path: root/lua/plugins/lsp-config.lua
diff options
context:
space:
mode:
authorlistout <listout@protonmail.com>2022-09-13 21:10:01 +0530
committerlistout <listout@protonmail.com>2022-09-13 21:10:01 +0530
commitf843419fe68dcbb8eda5ab6d0ed312742b71365e (patch)
tree10c6a11d6ed460ac86b4a04f9626b46ec8147f5b /lua/plugins/lsp-config.lua
parent6d513494ff8ca3b3611357fc36dcdd7d2235ff54 (diff)
nvim: plugins: lsp-config: virtual text and signs
This commit will: - Turn off virtual text for diagnostics and error - use custom signs for error, diagnostics, ... - Stop using `vim.api.nvim_buf_set_option`. Don't know what it's used for Signed-off-by: listout <listout@protonmail.com>
Diffstat (limited to 'lua/plugins/lsp-config.lua')
-rw-r--r--lua/plugins/lsp-config.lua20
1 files changed, 19 insertions, 1 deletions
diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua
index c4dce46..deb02d4 100644
--- a/lua/plugins/lsp-config.lua
+++ b/lua/plugins/lsp-config.lua
@@ -1,6 +1,23 @@
-- Add additional capabilities supported by nvim-cmp
local M = {}
+vim.diagnostic.config({
+ virtual_text = false,
+ signs = true,
+ underline = true,
+ update_in_insert = false,
+ severity_sort = false,
+})
+
+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 = hl })
+end
+
+vim.o.updatetime = 250
+vim.cmd [[autocmd! CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]]
+
vim.cmd [[autocmd! ColorScheme * highlight NormalFloat guibg=#1f2335]]
vim.cmd [[autocmd! ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]]
@@ -48,7 +65,8 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, opts)
-- after the language server attaches to the current buffer
M.on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
+ -- I don't need it.
+ -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions