fix(async): properly trigger callbacks when canceling and fix delays in throttle.sync (#1611)

This commit is contained in:
Folke Lemaitre
2023-06-09 12:08:28 +02:00
committed by GitHub
parent b5a636d46c
commit 6f118169af
2 changed files with 23 additions and 11 deletions

View File

@@ -383,12 +383,11 @@ entry.match = function(self, input, matching_config)
score, matches = matcher.match(input, filter_text, option)
-- Support the language server that doesn't respect VSCode's behaviors.
local prefix = ''
if score == 0 then
if self:get_completion_item().textEdit and not misc.empty(self:get_completion_item().textEdit.newText) then
local diff = self.source_offset - self:get_offset()
if diff > 0 then
prefix = string.sub(self.context.cursor_line, self:get_offset(), self:get_offset() + diff)
local prefix = string.sub(self.context.cursor_line, self:get_offset(), self:get_offset() + diff)
local accept = nil
accept = accept or string.match(prefix, '^[^%a]+$')
accept = accept or string.find(self:get_completion_item().textEdit.newText, prefix, 1, true)