feat(diagnostic): add option to include diagnostic source

Add an option to virtual text display and floating window previews to
include diagnostic source in the diagnostic message.
This commit is contained in:
Gregory Anders
2021-09-18 15:00:32 -06:00
parent 17b7968f02
commit d43151ea0b
4 changed files with 166 additions and 30 deletions

View File

@@ -103,6 +103,7 @@ local function diagnostic_lsp_to_vim(diagnostics, bufnr, client_id)
end_col = line_byte_from_position(buf_lines, _end.line, _end.character, offset_encoding),
severity = severity_lsp_to_vim(diagnostic.severity),
message = diagnostic.message,
source = diagnostic.source,
user_data = {
lsp = {
code = diagnostic.code,
@@ -132,6 +133,7 @@ local function diagnostic_vim_to_lsp(diagnostics)
},
severity = severity_vim_to_lsp(diagnostic.severity),
message = diagnostic.message,
source = diagnostic.source,
}, diagnostic.user_data and (diagnostic.user_data.lsp or {}) or {})
end, diagnostics)
end