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:
+4
-4
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user