From 4ac106cdb0324a25ee1fe8bc6af7f7c25cfe0417 Mon Sep 17 00:00:00 2001 From: andrzej Date: Mon, 6 May 2024 23:01:11 +0200 Subject: [PATCH] add float styling --- nvim/.config/nvim/lua/plugins/lsp.lua | 34 +++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index cdb5c49..e6060e8 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -94,6 +94,13 @@ return { -- LSP Configuration & Plugins end end, }) + --bring up a popup when the cursor hovers over an error + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + group = vim.api.nvim_create_augroup("float_diagnostic", { clear = true }), + callback = function() + vim.diagnostic.open_float(nil, { focus = false }) + end, + }) -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP Specification. @@ -112,8 +119,31 @@ return { -- LSP Configuration & Plugins -- - settings (table): Override the default settings passed when initializing the server. -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ -- - local arch = require("jit").arch - --get architecture as string (to blocklist installs that don't work on Android) + --Pop-up border styling + local border = { + { "🭽", "FloatBorder" }, + { "▔", "FloatBorder" }, + { "🭾", "FloatBorder" }, + { "▕", "FloatBorder" }, + { "🭿", "FloatBorder" }, + { "▁", "FloatBorder" }, + { "🭼", "FloatBorder" }, + { "▏", "FloatBorder" }, + } + local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview + function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) + opts = opts or {} + opts.border = opts.border or border + return orig_util_open_floating_preview(contents, syntax, opts, ...) + end + --global diagnostic popup options + vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + update_in_insert = true, + severity_sort = false, + }) local servers = { -- clangd = {},