4 -- See `:help vim.diagnostic.*` for documentation on any of the below functions
5 M
.setup
= function() --<--
6 require("lsp.mappings").setup
.default()
7 require("lsp.mappings").setup
.lspsaga()
11 { name
= "DiagnosticSignError", text
= "" },
12 { name
= "DiagnosticSignWarn", text
= "" },
13 { name
= "DiagnosticSignHint", text
= "" },
14 { name
= "DiagnosticSignInfo", text
= "" },
17 for _
, sign
in ipairs(signs
) do
18 vim
.fn
.sign_define(sign
.name
, { texthl
= sign
.name
, text
= sign
.text
, numhl
= "" })
21 vim
.diagnostic
.config({ --<--
23 signs
= { active
= signs
},
24 update_in_insert
= false,
34 format = require("lsp.fn.float_text").format,
38 local handlers
= vim
.lsp
.handlers
39 local with
= vim
.lsp
.with
40 handlers
["textDocument/hover"] = with(handlers
.hover
, { silent
= true, border
= "rounded" })
41 handlers
["textDocument/signatureHelp"] = with(handlers
.signature_help
, { border
= "rounded" })
43 require("lsp.fn.list_capabilities")
45 vim
.api
.nvim_create_user_command("ClearLspLog", function()
46 vim
.fn
.delete(require("vim.lsp.log").get_filename())
47 end, { desc
= "Delete LSP log file." })
50 M
.mappings
= function(buf
) --<--
51 for _
, f
in pairs(require("lsp.mappings").on_attach
) do
56 M
.buffer_options
= function(buf
) --<--
57 -- Enable completion triggered by <c-x><c-o>
58 vim
.bo
[buf
].omnifunc
= "v:lua.vim.lsp.omnifunc"
61 M
.capabilities
= function(client
, buf
) --<--
62 if client
.server_capabilities
.documentHighlightProvider
then
63 local group
= vim
.api
.nvim_create_augroup("lsp_document_highlight", {})
65 CursorHold
= vim
.lsp
.buf
.document_highlight
,
66 CursorMoved
= vim
.lsp
.buf
.clear_references
,
68 for event
, callback
in pairs(autocmds
) do
69 vim
.api
.nvim_create_autocmd(event
, { group
= group
, buffer
= buf
, callback
= callback
})
74 M
.on_attach
= function(client
, buf
) --<--
77 M
.capabilities(client
, buf
)