diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2022-02-20 14:10:31 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2022-02-20 14:16:42 +0100 |
| commit | d423105cf6490331039ddfe53514f7a61d2eea88 (patch) | |
| tree | e612945c22ab1ee88015ca8348fbebe1b38fcf9b | |
| parent | 47b7b1e47bb10183f5b4ee84d90b4e3eefabe75c (diff) | |
| download | vis-lspc-add-markup-type-detection-functions.tar.gz vis-lspc-add-markup-type-detection-functions.zip | |
add utility functions detecting certain return typesadd-markup-type-detection-functions
| -rw-r--r-- | init.lua | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -574,6 +574,19 @@ local function vis_apply_workspaceEdit(_, _, workspaceEdit) end end +-- Detect a MarkedString +-- https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#markedString +local function lsp_is_marked_string(s) + return type(s) == 'string' or (type(s) == 'table' and s.language and s.value) +end + +-- Detect MarkupContent +-- https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#markupContent +local function lsp_is_markup_content(s) + return type(s) == 'table' and s.kind and + (s.kind == 'markdown' or s.kind == 'plaintext') and s.value +end + local function lspc_highlight_diagnostics(win, diagnostics) for _, diagnostic in ipairs(diagnostics) do local range = diagnostic.vis_range |
