mirror of
https://github.com/hrsh7th/cmp-buffer
synced 2025-04-08 10:32:58 +00:00
rename indexing_chunk_size to indexing_batch_size
This commit is contained in:
parent
a3ab9bec60
commit
c8daddb987
@ -150,16 +150,16 @@ function buffer.start_indexing_timer(self)
|
||||
self.timer_current_line = self.timer_current_line + 1
|
||||
end
|
||||
|
||||
local chunk_start = self.timer_current_line
|
||||
local chunk_size = self.opts.indexing_chunk_size
|
||||
local batch_start = self.timer_current_line
|
||||
local batch_size = self.opts.indexing_batch_size
|
||||
-- NOTE: self.lines_count may be modified by the indexer.
|
||||
local chunk_end = chunk_size >= 1 and math.min(chunk_start + chunk_size, self.lines_count) or self.lines_count
|
||||
if chunk_end >= self.lines_count then
|
||||
local batch_end = batch_size >= 1 and math.min(batch_start + batch_size, self.lines_count) or self.lines_count
|
||||
if batch_end >= self.lines_count then
|
||||
self:stop_indexing_timer()
|
||||
end
|
||||
|
||||
self:index_range(chunk_start, chunk_end, true)
|
||||
self.timer_current_line = chunk_end
|
||||
self:index_range(batch_start, batch_end, true)
|
||||
self.timer_current_line = batch_end
|
||||
self:mark_all_lines_dirty()
|
||||
end)
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ local buffer = require('cmp_buffer.buffer')
|
||||
---@field public keyword_length number
|
||||
---@field public keyword_pattern string
|
||||
---@field public get_bufnrs fun(): number[]
|
||||
---@field public indexing_chunk_size number
|
||||
---@field public indexing_batch_size number
|
||||
---@field public indexing_interval number
|
||||
|
||||
---@type cmp_buffer.Options
|
||||
@ -14,7 +14,7 @@ local defaults = {
|
||||
get_bufnrs = function()
|
||||
return { vim.api.nvim_get_current_buf() }
|
||||
end,
|
||||
indexing_chunk_size = 1000,
|
||||
indexing_batch_size = 1000,
|
||||
indexing_interval = 100,
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ source._validate_options = function(_, params)
|
||||
keyword_length = { opts.keyword_length, 'number' },
|
||||
keyword_pattern = { opts.keyword_pattern, 'string' },
|
||||
get_bufnrs = { opts.get_bufnrs, 'function' },
|
||||
indexing_chunk_size = { opts.indexing_chunk_size, 'number' },
|
||||
indexing_batch_size = { opts.indexing_batch_size, 'number' },
|
||||
indexing_interval = { opts.indexing_interval, 'number' },
|
||||
})
|
||||
return opts
|
||||
@ -82,6 +82,7 @@ source.complete = function(self, params, callback)
|
||||
end
|
||||
|
||||
---@param opts cmp_buffer.Options
|
||||
---@return cmp_buffer.Buffer[]
|
||||
source._get_buffers = function(self, opts)
|
||||
local buffers = {}
|
||||
for _, bufnr in ipairs(opts.get_bufnrs()) do
|
||||
|
Loading…
Reference in New Issue
Block a user