diff --git a/lua/cmp/core.lua b/lua/cmp/core.lua index 2393cc9..d7432da 100644 --- a/lua/cmp/core.lua +++ b/lua/cmp/core.lua @@ -444,7 +444,8 @@ core.confirm = function(self, e, option, callback) if api.is_insert_mode() then if false then --To use complex expansion debug. - vim.pretty_print({ -- luacheck: ignore + vim.print({ -- luacheck: ignore + item = e:get_completion_item(), diff_before = diff_before, diff_after = diff_after, new_text = new_text, diff --git a/lua/cmp/core_spec.lua b/lua/cmp/core_spec.lua index 2047577..9993215 100644 --- a/lua/cmp/core_spec.lua +++ b/lua/cmp/core_spec.lua @@ -33,7 +33,8 @@ describe('cmp.core', function() end) end) feedkeys.call(filter, 'n', function() - c:confirm(c.sources[s.id].entries[1], {}, function() end) + c:confirm(c.sources[s.id].entries[1], {}, function() + end) end) local state = {} feedkeys.call('', 'x', function() @@ -90,6 +91,29 @@ describe('cmp.core', function() assert.are.same(state.cursor, { 3, 3 }) end) + it('#1552', function() + local state = confirm(keymap.t('ios.'), '', { + filterText = "IsPermission", + insertTextFormat = 2, + label = "IsPermission", + textEdit = { + newText = "IsPermission($0)", + range = { + ["end"] = { + character = 3, + line = 0 + }, + start = { + character = 3, + line = 0 + } + } + } + }) + assert.are.same(state.buffer, { 'os.IsPermission()' }) + assert.are.same(state.cursor, { 1, 16 }) + end) + it('insertText & snippet', function() local state = confirm('iA', 'IU', { label = 'AIUEO', @@ -156,7 +180,7 @@ describe('cmp.core', function() }, { position_encoding_kind = case.encoding, }) - vim.pretty_print({ state = state, case = case }) + vim.print({ state = state, case = case }) assert.are.same(state.buffer, { ('%s:%s%s%s%s%s:%s'):format(char, char, char, char, char, char, char) }) assert.are.same(state.cursor, { 1, #('%s:%s%s%s%s%s'):format(char, char, char, char, char, char) }) end)