commit 8cd9feb50166202bf55315934f14f74e63c8fcb4
parent 2ed6423c7e9d4911343d3e2049908f4b78ec7a55
Author: altermo <107814000+altermo@users.noreply.github.com>
Date: Sun, 26 May 2024 13:08:57 +0200
fix(tohtml): ignore lsp inlay hints
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/runtime/lua/tohtml.lua b/runtime/lua/tohtml.lua
@@ -481,10 +481,17 @@ end
--- @param state vim.tohtml.state
--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
-local function _styletable_extmarks_virt_text(state, extmark)
+--- @param namespaces table<integer,string>
+local function _styletable_extmarks_virt_text(state, extmark, namespaces)
if not extmark[4].virt_text then
return
end
+ ---TODO(altermo) LSP semantic tokens (and some other extmarks) are only
+ ---generated in visible lines, and not in the whole buffer.
+ if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_inlayhint') then
+ vim.notify_once('Info(TOhtml): lsp inlay hints are not supported, HTML may be incorrect')
+ return
+ end
local styletable = state.style
--- @type integer,integer
local row, col = extmark[2], extmark[3]
@@ -586,7 +593,7 @@ local function styletable_extmarks(state)
_styletable_extmarks_conceal(state, v)
end
for _, v in ipairs(extmarks) do
- _styletable_extmarks_virt_text(state, v)
+ _styletable_extmarks_virt_text(state, v, namespaces)
end
for _, v in ipairs(extmarks) do
_styletable_extmarks_virt_lines(state, v)