debug completion

This commit is contained in:
Jonas Widen 2025-03-17 07:37:37 +01:00
parent 168e01100e
commit 600d0f8b43

View File

@ -205,9 +205,9 @@ function M.trigger_completion()
debug_print("Current line: %s, col: %d", current_line or "nil", col) debug_print("Current line: %s, col: %d", current_line or "nil", col)
-- Don't trigger completion if line is empty or cursor is at the start -- Don't trigger completion if line is empty
if not current_line or col == 0 or current_line:match("^%s*$") then if not current_line or current_line:match("^%s*$") then
debug_print("Skipping: empty line or cursor at start") debug_print("Skipping: empty line")
clear_suggestion() clear_suggestion()
return return
end end
@ -217,11 +217,10 @@ function M.trigger_completion()
debug_print("Prefix: %s", prefix) debug_print("Prefix: %s", prefix)
-- Don't trigger on certain conditions -- Modified conditions: only skip if the line is completely empty
if prefix:match("^%s*$") or -- empty or whitespace -- or if we're in the middle of whitespace
prefix:match("[%s%-]$") or -- ends with space or dash if prefix:match("^%s*$") then
#prefix < 3 then -- too short debug_print("Skipping: empty prefix")
debug_print("Skipping: prefix conditions not met")
clear_suggestion() clear_suggestion()
return return
end end