summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/private/xrepo/quick_search/completion.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmake/modules/private/xrepo/quick_search/completion.lua b/xmake/modules/private/xrepo/quick_search/completion.lua
index b8cb18891..7f6a1b3a4 100644
--- a/xmake/modules/private/xrepo/quick_search/completion.lua
+++ b/xmake/modules/private/xrepo/quick_search/completion.lua
@@ -33,14 +33,22 @@ end
function main(complete, opt)
local prefix = ""
+
+ -- check prefix if present
if complete:find("::", 1, true) then
prefix = complete:sub(1, complete:find("::", 1, true) - 1)
complete = complete:sub(complete:find("::", 1, true) + 2)
end
+
local packages
+
+ -- complete xmake packages
if prefix == "" or prefix == "xmake" then
packages = _xmake_package_complete(complete, opt)
end
+
+ -- to prevent shell completion misunderstandings,
+ -- we put back the prefix
if packages and prefix ~= "" then
for _, package in ipairs(packages) do
package.value = prefix .. "::" .. package.value