diff options
| -rw-r--r-- | xmake/modules/private/xrepo/quick_search/complete.lua | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/xmake/modules/private/xrepo/quick_search/complete.lua b/xmake/modules/private/xrepo/quick_search/complete.lua index 1b3c58c85..e6d117b88 100644 --- a/xmake/modules/private/xrepo/quick_search/complete.lua +++ b/xmake/modules/private/xrepo/quick_search/complete.lua @@ -20,7 +20,7 @@ import("private.xrepo.quick_search.cache") -function main(complete, opt) +function xmake_package_complete(complete, opt) local packages = cache.get() local candidates = {} for _, package in ipairs(packages) do @@ -29,4 +29,22 @@ function main(complete, opt) end end return candidates +end + +function main(complete, opt) + local prefix = "" + 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 + if prefix == "" or prefix == "xmake" then + packages = xmake_package_complete(complete, opt) + end + if packages and prefix ~= "" then + for _, package in ipairs(packages) do + package.value = prefix .. "::" .. package.value + end + end + return packages or {} end
\ No newline at end of file |
