From 48cbe3022fc65254feebe042f8b7b37cd0182610 Mon Sep 17 00:00:00 2001 From: hrsh7th Date: Fri, 6 Aug 2021 21:14:38 +0900 Subject: [PATCH] Improve triggerCharacter handling on triggerOnly reason --- lua/cmp/source.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/cmp/source.lua b/lua/cmp/source.lua index 2537e0b..4a4d78f 100644 --- a/lua/cmp/source.lua +++ b/lua/cmp/source.lua @@ -199,6 +199,15 @@ source.complete = function(self, ctx, callback) local before_char = string.sub(ctx.cursor_before_line, -1) local before_char_iw = string.match(ctx.cursor_before_line, '(.)%s*$') or before_char + if ctx:get_reason() == types.cmp.ContextReason.TriggerOnly then + if string.match(before_char, '^%a+$') then + before_char = '' + end + if string.match(before_char_iw, '^%a+$') then + before_char_iw = '' + end + end + local completion_context if ctx:get_reason() == types.cmp.ContextReason.Manual then completion_context = {