This commit is contained in:
hrsh7th
2021-09-14 03:15:18 +09:00
parent a212356641
commit 445179dca8
2 changed files with 10 additions and 9 deletions

View File

@@ -292,11 +292,6 @@ core.confirm = function(e, option, callback)
local suspending = core.suspend()
local ctx = core.get_context()
-- Try to resolve for only 100ms.
async.sync(function(done)
e:resolve(done)
end, 100)
-- Simulate `<C-y>` behavior.
local confirm = {}
table.insert(confirm, keymap.t(string.rep('<C-g>U<Left><Del>', ctx.cursor.character - misc.to_utfindex(e.context.cursor_before_line, e:get_offset()))))

View File

@@ -309,10 +309,16 @@ end
---Get resolved completion item if possible.
---@return lsp.CompletionItem
entry.get_completion_item = function(self)
if self.resolved_completion_item then
return self.resolved_completion_item
end
return self.completion_item
return self.cache:ensure({ 'get_completion_item', (self.resolved_completion_item and 1 or 0) }, function()
if self.resolved_completion_item then
local completion_item = misc.copy(self.completion_item)
completion_item.detail = self.resolved_completion_item.detail or completion_item.detail
completion_item.documentation = self.resolved_completion_item.documentation or completion_item.documentation
completion_item.additionalTextEdits = self.resolved_completion_item.additionalTextEdits or completion_item.additionalTextEdits
return completion_item
end
return self.completion_item
end)
end
---Create documentation