diff --git a/src/main.lua b/src/main.lua index ff90c47..bdd1982 100644 --- a/src/main.lua +++ b/src/main.lua @@ -838,7 +838,7 @@ function handlers.textDocument_completion(params) if prefix == "" or name:upper():find("^" .. prefix:upper(), 1, true) then table.insert(items, { label = "#" .. name, - filterText = name, + filterText = "#" .. name, kind = 13, detail = "Variable (" .. (info.type or "VAR") .. "): " .. (info.data_type or "unknown"), insertText = "#" .. name, @@ -969,12 +969,12 @@ function handlers.textDocument_completion(params) end end - -- Add declared variables (without # prefix in label, insert with #) + -- Add declared variables (label without # so client-side matching works) if doc.variables then for name, info in pairs(doc.variables) do if word_prefix == "" or name:upper():find("^" .. word_prefix:upper(), 1, true) then table.insert(items, { - label = "#" .. name, + label = name, filterText = name, kind = 13, detail = "Variable (" .. (info.type or "VAR") .. "): " .. (info.data_type or "unknown"), @@ -1008,7 +1008,7 @@ function handlers.textDocument_completion(params) for name, info in pairs(doc.variables) do if word_prefix == "" or name:upper():find("^" .. word_prefix:upper(), 1, true) then table.insert(items, { - label = "#" .. name, + label = name, filterText = name, kind = 13, detail = "Variable (" .. (info.type or "VAR") .. "): " .. (info.data_type or "unknown"),