This commit is contained in:
hrsh7th
2022-10-15 15:16:27 +09:00
parent bf1b112615
commit 69476c9e06
4 changed files with 8 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
local api = require('cmp.utils.api')
local context = {}
---Check if cursor is in syntax group
@@ -5,7 +7,7 @@ local context = {}
---@return boolean
context.in_syntax_group = function(group)
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
if not vim.api.nvim_get_mode().mode == 'i' then
if not api.is_insert_mode() then
col = col + 1
end
@@ -34,8 +36,7 @@ context.in_treesitter_capture = function(capture)
end
local get_captures_at_pos = -- See neovim/neovim#20331
require('vim.treesitter').get_captures_at_pos -- for neovim >= 0.8
or require('vim.treesitter').get_captures_at_position -- for neovim < 0.8
require('vim.treesitter').get_captures_at_pos -- for neovim >= 0.8 or require('vim.treesitter').get_captures_at_position -- for neovim < 0.8
local captures_at_cursor = vim.tbl_map(function(x)
return x.capture

View File

@@ -239,14 +239,14 @@ entry.get_vim_item = function(self, suggest_offset)
local is_expandable = false
local expandable_indicator = config.get().formatting.expandable_indicator
if #(misc.safe(completion_item.additionalTextEdits) or {}) > 0 then
is_expandable = true
is_expandable = true
elseif completion_item.insertTextFormat == types.lsp.InsertTextFormat.Snippet then
is_expandable = self:get_insert_text() ~= word
is_expandable = self:get_insert_text() ~= word
elseif completion_item.kind == types.lsp.CompletionItemKind.Snippet then
is_expandable = true
is_expandable = true
end
if expandable_indicator and is_expandable then
abbr = abbr .. '~'
abbr = abbr .. '~'
end
-- append delta text

View File

@@ -1,6 +1,4 @@
local spec = require('cmp.utils.spec')
local source = require('cmp.source')
local async = require('cmp.utils.async')
local entry = require('cmp.entry')

View File

@@ -48,7 +48,6 @@ end
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 }
end
return vim.api.nvim_win_get_cursor(0)
end