From 3abb0f5d9a364d71f6f2e72c034830a6155fa9fa Mon Sep 17 00:00:00 2001 From: Lazar Bulovan Date: Wed, 22 Jul 2026 14:55:20 +0200 Subject: [PATCH] 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 #. --- src/main.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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"),