refactor(nvim): better lsp file organization

This commit is contained in:
Price Hiller 2022-07-17 17:48:03 -05:00
parent c1f7efb478
commit d4922a19c7
3 changed files with 46 additions and 48 deletions

View File

@ -1,5 +1,50 @@
local M = {}
M.setup = function() end
M.setup = function()
local function lspSymbol(name, icon)
local hl = 'DiagnosticSign' .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end
lspSymbol('Error', '')
lspSymbol('Warn', '')
lspSymbol('Info', '')
lspSymbol('Hint', '')
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
-- vim.o.updatetime = 100
-- vim.cmd([[autocmd CursorHold,CursorHoldI,CmdlineEnter * lua vim.diagnostic.open_float(nil, {focus=false})]])
vim.diagnostic.config({
virtual_text = true,
severity_sort = true,
underline = true,
update_in_insert = false,
float = {
focusable = false,
style = 'minimal',
border = 'rounded',
source = 'always',
header = '',
prefix = '',
},
})
end
return M

View File

@ -1,44 +0,0 @@
local function lspSymbol(name, icon)
local hl = 'DiagnosticSign' .. name
vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl })
end
lspSymbol('Error', '')
lspSymbol('Warn', '')
lspSymbol('Info', '')
lspSymbol('Hint', '')
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
-- vim.o.updatetime = 100
-- vim.cmd([[autocmd CursorHold,CursorHoldI,CmdlineEnter * lua vim.diagnostic.open_float(nil, {focus=false})]])
vim.diagnostic.config({
virtual_text = true,
severity_sort = true,
underline = true,
update_in_insert = false,
float = {
focusable = false,
style = 'minimal',
border = 'rounded',
source = 'always',
header = '',
prefix = '',
},
})

View File

@ -237,9 +237,6 @@ return packer.startup({
-- LSP, LSP Installer
use({
'neovim/nvim-lspconfig',
config = function()
require('plugins.configs.lspconfig')
end,
requires = {
'folke/lua-dev.nvim',
'Decodetalkers/csharpls-extended-lsp.nvim',