Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit edfdb8c

Browse files
committed
fix: error on apply additionalTextEdits(#64)
1 parent 275d588 commit edfdb8c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/completion.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ local api = vim.api
33
local source = require 'source'
44
local signature = require'completion.signature_help'
55
local hover = require'completion.hover'
6+
if vim.env.SNIPPETS then
7+
vim.snippet = require 'snippet'
8+
end
69
local M = {}
710

811
------------------------------------------------------------------------
@@ -51,7 +54,7 @@ end
5154
function M.confirmCompletion()
5255
if M.completionConfirm == true then
5356
local complete_item = api.nvim_get_vvar('completed_item')
54-
local lnum, _ = api.nvim_win_get_cursor(0)
57+
local lnum, _ = unpack(api.nvim_win_get_cursor(0))
5558
local item = complete_item.user_data.lsp.completion_item
5659
local bufnr = api.nvim_get_current_buf()
5760
if item.additionalTextEdits then
@@ -65,6 +68,9 @@ function M.confirmCompletion()
6568
if vim.g.completion_enable_auto_paren == 1 then
6669
M.autoAddParens(complete_item)
6770
end
71+
if complete_item.kind == 'Snippet' and vim.snippet ~= nil then
72+
vim.snippet.expand_at_cursor(complete_item.word)
73+
end
6874
if complete_item.kind == 'UltiSnips' then
6975
api.nvim_call_function('UltiSnips#ExpandSnippet', {})
7076
elseif complete_item.kind == 'Neosnippet' then

0 commit comments

Comments
 (0)