diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2022-02-20 14:11:30 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2022-02-20 14:15:57 +0100 |
| commit | 16f70ee02942e489fdf383c71d1439912ab6a008 (patch) | |
| tree | ac10cab4130e622dcbcbf2d4c16266f443e9c4a0 | |
| parent | e277fe0994cf32359f701e1875e231e39183f316 (diff) | |
| download | vis-lspc-16f70ee02942e489fdf383c71d1439912ab6a008.tar.gz vis-lspc-16f70ee02942e489fdf383c71d1439912ab6a008.zip | |
support hoverResults containing MarkedString[]
python-language-server sends a list of MarkedStrings containing
the signature as python code-block and the doc string as string.
https://github.com/palantir/python-language-server/issues/836
| -rw-r--r-- | init.lua | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -757,8 +757,22 @@ local function lspc_handle_hover_method_response(win, result, old_pos) local hover_header = '--- hover: ' .. (win.file.path or '') .. ':' .. sel.line .. ', ' .. sel.col .. ' ---' - -- extract the string value from a possible MarkupContent object - local hover_msg = result.contents.value or result.contents + + local hover_msg = '' + -- result is MarkedString[] + if type(result.contents) == 'table' then + lspc.log('hover returned list of length ' .. #result.contents) + for i, v in ipairs(result.contents) do + if i == 1 then + hover_msg = v.value or v + else + hover_msg = hover_msg .. '\n---\n' .. (v.value or v) + end + end + -- result is either MarkedString or MarkupContent + else + hover_msg = result.contents.value or result.contents + end vis:message(hover_header .. '\n' .. hover_msg) end |
