feat: Hook based overrides

This commit is contained in:
Morten Olsen 2021-08-31 16:20:57 +02:00 committed by siduck76
parent bfc10e6034
commit eced5f2ec4
3 changed files with 44 additions and 2 deletions

View file

@ -1,4 +1,5 @@
local present1, nvim_lsp = pcall(require, "lspconfig")
local overrides = require("core.hooks").createOverrides("lsp")
if not present1 then
return
@ -81,7 +82,7 @@ lspSymbol("Information", "")
lspSymbol("Hint", "")
lspSymbol("Warning", "")
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
local lsp_publish_diagnostics_options = overrides.get('publish_diagnostics', {
virtual_text = {
prefix = "",
spacing = 0,
@ -90,6 +91,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagn
underline = true,
update_in_insert = false, -- update diagnostics insert mode
})
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, lsp_publish_diagnostics_options)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "single",
})