Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
improve textEdit position
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed Nov 4, 2023
1 parent 65cde44 commit cfc7f10
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lua/epo/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,13 @@ local function complete_ondone(bufnr)
if is_snippet and completion_item.textEdit.newText:find('%$') then
offset_snip = completion_item.textEdit.newText
else
-- work around with auto pairs plugin
-- local t = {} t[#|] -- trigger here
-- work around with pair
-- situation1: local t = {} t[#|]<--
-- situation2: #include "header item|""<--
local newText = completion_item.textEdit.newText
local range = completion_item.textEdit.range
local nextchar = curline:sub(col + 1, col + 1)
local determine = newText:sub(#item.abbr + 1, #item.abbr + 1)
local determine = newText:sub(#item.word, #item.word)
if col ~= #curline and determine == nextchar then
range['end'].character = col + 1
api.nvim_win_set_cursor(0, { lnum, col + 1 })
Expand Down

0 comments on commit cfc7f10

Please sign in to comment.