diff --git a/src/main.lua b/src/main.lua index fb8a951..d894d5d 100644 --- a/src/main.lua +++ b/src/main.lua @@ -831,11 +831,10 @@ function handlers.textDocument_completion(params) end end - if trigger == "#" or has_hash_prefix then + if trigger == "#" then if doc.variables then - local prefix = has_hash_prefix and line_before:match("#([%w_]*)$") or word_prefix for name, info in pairs(doc.variables) do - if prefix == "" or name:upper():sub(1, #prefix) == prefix:upper() then + if word_prefix == "" or name:upper():sub(1, #word_prefix) == word_prefix:upper() then table.insert(items, { label = "#" .. name, filterText = "#" .. name, @@ -848,9 +847,6 @@ function handlers.textDocument_completion(params) end end elseif trigger == "." then - -- Extract word before cursor, handling both cases: - -- 1) . IS in doc: cursor is after ., scan from col-1 - -- 2) . NOT in doc yet: cursor is at word end, scan from col local scan_end = col local c = col > 0 and line:sub(col, col) or "" if c == "" or c == "." then