mirror of
https://github.com/hrsh7th/nvim-cmp
synced 2024-09-16 20:54:03 +02:00
use nvim_get_option_value instead of nvim{,_buf,_win}_get_option
This commit is contained in:
parent
abacd4cb7f
commit
5260e5e8ec
5 changed files with 5 additions and 5 deletions
|
@ -108,7 +108,7 @@ config.get = function()
|
|||
end)
|
||||
else
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype')
|
||||
local filetype = vim.api.nvim_get_option_value('filetype', { buf = bufnr })
|
||||
local buffer_config = config.buffers[bufnr] or { revision = 1 }
|
||||
local filetype_config = config.filetypes[filetype] or { revision = 1 }
|
||||
return config.cache:ensure({
|
||||
|
|
|
@ -9,7 +9,7 @@ return function()
|
|||
local config = {
|
||||
enabled = function()
|
||||
local disabled = false
|
||||
disabled = disabled or (vim.api.nvim_buf_get_option(0, 'buftype') == 'prompt')
|
||||
disabled = disabled or (vim.api.nvim_get_option_value('buftype', { buf = 0 }) == 'prompt')
|
||||
disabled = disabled or (vim.fn.reg_recording() ~= '')
|
||||
disabled = disabled or (vim.fn.reg_executing() ~= '')
|
||||
return not disabled
|
||||
|
|
|
@ -43,7 +43,7 @@ context.new = function(prev_context, option)
|
|||
self.cache = cache.new()
|
||||
self.prev_context = prev_context or context.empty()
|
||||
self.option = option or { reason = types.cmp.ContextReason.None }
|
||||
self.filetype = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
self.filetype = vim.api.nvim_get_option_value('filetype', { buf = 0 })
|
||||
self.time = vim.loop.now()
|
||||
self.bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ end
|
|||
---@return { [1]: integer, [2]: integer }
|
||||
api.get_cursor = function()
|
||||
if api.is_cmdline_mode() then
|
||||
return { math.min(vim.o.lines, vim.o.lines - (vim.api.nvim_get_option('cmdheight') - 1)), vim.fn.getcmdpos() - 1 }
|
||||
return { math.min(vim.o.lines, vim.o.lines - (vim.api.nvim_get_option_value('cmdheight', {}) - 1)), vim.fn.getcmdpos() - 1 }
|
||||
end
|
||||
return vim.api.nvim_win_get_cursor(0)
|
||||
end
|
||||
|
|
|
@ -157,7 +157,7 @@ custom_entries_view.open = function(self, offset, entries)
|
|||
width = width + self.column_width.kind + (self.column_width.menu > 0 and 1 or 0)
|
||||
width = width + self.column_width.menu + 1
|
||||
|
||||
local height = vim.api.nvim_get_option('pumheight')
|
||||
local height = vim.api.nvim_get_option_value('pumheight', {})
|
||||
height = height ~= 0 and height or #self.entries
|
||||
height = math.min(height, #self.entries)
|
||||
|
||||
|
|
Loading…
Reference in a new issue