fix: remove # from label in non-hash completion paths

- When user types without # (e.g. instTestTimer), the label was still
  #instTestTimer, so client-side filtering rejected the match.
- Now label = name (bare) in general/var-section context, insertText
  still adds the # prefix for correct SCL insertion.
- # trigger branch sets filterText = "#" .. name to match the #-prefixed
  word the client sends after typing #.
This commit is contained in:
2026-07-22 14:55:20 +02:00
parent a33d15d238
commit 3abb0f5d9a
+4 -4
View File
@@ -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"),