refactor(completion): evolve Request into Session + surface-level cleanup

This commit is contained in:
2026-04-18 02:35:36 +02:00
parent 40a8f8cdd3
commit 405a176758
4 changed files with 147 additions and 77 deletions
+9 -7
View File
@@ -1,6 +1,7 @@
local MAX_WIDTH = 80
local MAX_HEIGHT = 20
local HALF_HEIGHT = math.floor(MAX_HEIGHT / 2)
local SNIPPET_KIND = vim.lsp.protocol.CompletionItemKind.Snippet
local NS = vim.api.nvim_create_namespace("ow.lsp.completion.popup")
@@ -28,14 +29,15 @@ end
---@return integer? width
local function build_content(item, ft)
local sections = {}
if item.detail then
table.insert(sections, fence(ft, item.detail))
end
if item.snippet then
if item.snippet and item.raw.kind == SNIPPET_KIND then
table.insert(sections, fence(ft, item.snippet))
end
if item.doc then
table.insert(sections, item.doc)
else
if item.detail then
table.insert(sections, fence(ft, item.detail))
end
if item.doc then
table.insert(sections, item.doc)
end
end
if #sections == 0 then
return nil, nil