* Expose get_selected_entry() from view module to main cmp module fixes #385 * add get_active_entry() also * fix linting * remove unused vars Co-authored-by: alex.tylor <atylor@gmail.com>
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
local api = require('cmp.utils.api')
|
||||
|
||||
local mapping
|
||||
mapping = setmetatable({}, {
|
||||
__call = function(_, invoke, modes)
|
||||
|
||||
@@ -389,7 +389,7 @@ core.confirm = function(self, e, option, callback)
|
||||
},
|
||||
['end'] = snippet_ctx.cursor,
|
||||
},
|
||||
newText = ''
|
||||
newText = '',
|
||||
} })
|
||||
config.get().snippet.expand({
|
||||
body = completion_item.textEdit.newText,
|
||||
|
||||
@@ -49,6 +49,16 @@ cmp.visible = function()
|
||||
return cmp.core.view:visible() or vim.fn.pumvisible() == 1
|
||||
end
|
||||
|
||||
---Get current selected entry or nil
|
||||
cmp.get_selected_entry = function()
|
||||
return cmp.core.view:get_selected_entry()
|
||||
end
|
||||
|
||||
---Get current active entry or nil
|
||||
cmp.get_active_entry = function()
|
||||
return cmp.core.view:get_active_entry()
|
||||
end
|
||||
|
||||
---Close current completion
|
||||
cmp.close = function()
|
||||
if cmp.core.view:visible() then
|
||||
|
||||
@@ -351,7 +351,7 @@ keymap.spec = function()
|
||||
keymap.feedkeys(keymap.t('foo2'), 'n')
|
||||
keymap.feedkeys(keymap.t('bar2'), 'nt')
|
||||
keymap.feedkeys(keymap.t('baz2'), 'n', function()
|
||||
vim.cmd[[normal! q]]
|
||||
vim.cmd([[normal! q]])
|
||||
end)
|
||||
keymap.feedkeys(keymap.t('baz1'), 'ni')
|
||||
keymap.feedkeys(keymap.t('bar1'), 'nti')
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
local cache = require('cmp.utils.cache')
|
||||
local misc = require('cmp.utils.misc')
|
||||
local buffer = require('cmp.utils.buffer')
|
||||
local api = require('cmp.utils.api')
|
||||
|
||||
---@class cmp.WindowStyle
|
||||
---@field public relative string
|
||||
|
||||
Reference in New Issue
Block a user