This commit is contained in:
NAKAI Tsuyoshi
2023-02-27 15:28:01 +09:00
committed by GitHub
parent 7a3b1e76f7
commit 339186c979
6 changed files with 29 additions and 97 deletions

View File

@@ -1,6 +1,5 @@
local types = require('cmp.types')
local cache = require('cmp.utils.cache')
local misc = require('cmp.utils.misc')
local compare = {}

View File

@@ -60,7 +60,7 @@ entry.get_offset = function(self)
if self:get_completion_item().textEdit then
local range = self:get_insert_range()
if range then
offset = self.context.cache:ensure('entry:' .. 'get_offset:'.. tostring(range.start.character), function()
offset = self.context.cache:ensure('entry:' .. 'get_offset:' .. tostring(range.start.character), function()
for idx = range.start.character + 1, self.source_offset do
if not char.is_white(string.byte(self.context.cursor_line, idx)) then
return idx
@@ -361,14 +361,7 @@ end
---@param matching_config cmp.MatchingConfig
---@return { score: integer, matches: table[] }
entry.match = function(self, input, matching_config)
return self.match_cache:ensure(
input .. ':' ..
(self.resolved_completion_item and '1' or '0' .. ':') ..
(matching_config.disallow_fuzzy_matching and '1' or '0') .. ':' ..
(matching_config.disallow_partial_fuzzy_matching and '1' or '0') .. ':' ..
(matching_config.disallow_partial_matching and '1' or '0') .. ':' ..
(matching_config.disallow_prefix_unmatching and '1' or '0')
, function()
return self.match_cache:ensure(input .. ':' .. (self.resolved_completion_item and '1' or '0' .. ':') .. (matching_config.disallow_fuzzy_matching and '1' or '0') .. ':' .. (matching_config.disallow_partial_fuzzy_matching and '1' or '0') .. ':' .. (matching_config.disallow_partial_matching and '1' or '0') .. ':' .. (matching_config.disallow_prefix_unmatching and '1' or '0'), function()
local option = {
disallow_fuzzy_matching = matching_config.disallow_fuzzy_matching,
disallow_partial_fuzzy_matching = matching_config.disallow_partial_fuzzy_matching,