File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ local misc = require('cmp.utils.misc')
33local snippet = require (' cmp.utils.snippet' )
44local str = require (' cmp.utils.str' )
55local api = require (' cmp.utils.api' )
6+ local types = require (' cmp.types' )
67
78--- @class cmp.GhostTextView
89--- @field win number | nil
7778--- This function calculates the bytes of the entry to display calculating the number
7879--- of character differences instead of just byte difference.
7980ghost_text_view .text_gen = function (self , line , cursor_col )
80- local word = tostring (snippet .parse (self .entry :get_insert_text ()))
81+ local word = self .entry :get_insert_text ()
82+ if self .entry :get_completion_item ().insertTextFormat == types .lsp .InsertTextFormat .Snippet then
83+ word = tostring (snippet .parse (word ))
84+ end
8185 word = str .oneline (word )
8286 local word_clen = vim .str_utfindex (word )
8387 local cword = string.sub (line , self .entry :get_offset (), cursor_col )
You can’t perform that action at this time.
0 commit comments