From 9f05f465a26ddb82bb2cdda1c78b2cc253a7c843 Mon Sep 17 00:00:00 2001 From: Mattia Rigotti <4016834+matrig@users.noreply.github.com> Date: Fri, 7 Feb 2025 13:58:42 +0100 Subject: [PATCH] feat: only trigger suggestions for bib if @ is typed --- lua/mkdnflow/cmp.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/mkdnflow/cmp.lua b/lua/mkdnflow/cmp.lua index 44781ec..2a1343f 100644 --- a/lua/mkdnflow/cmp.lua +++ b/lua/mkdnflow/cmp.lua @@ -110,6 +110,11 @@ source.new = function() end function source:complete(params, callback) + -- Only provide suggestions if the current word in the context starts with the trigger character '@' + if not params.context.cursor_before_line or not params.context.cursor_before_line:match('%W@%w*$') then + callback({}) + return + end local items = get_files_items() if bib_paths then -- For bib files, there are three lists (tables) in mkdnflow where we might find the paths for a bib file