summaryrefslogtreecommitdiff
path: root/xmake/plugins/lua/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-01-05 23:28:29 +0800
committerruki <[email protected]>2023-01-05 23:28:29 +0800
commita0f3867e8536b187647f22e32e8e95aa4d69a508 (patch)
tree8bd1c8deb23e921eb8e84c8be78c07336777d883 /xmake/plugins/lua/xmake.lua
parentcea8d5760bd80be6f50676709d2353167b1f8fd7 (diff)
improve lua complete
Diffstat (limited to 'xmake/plugins/lua/xmake.lua')
-rw-r--r--xmake/plugins/lua/xmake.lua16
1 files changed, 14 insertions, 2 deletions
diff --git a/xmake/plugins/lua/xmake.lua b/xmake/plugins/lua/xmake.lua
index 792299651..60a12fe54 100644
--- a/xmake/plugins/lua/xmake.lua
+++ b/xmake/plugins/lua/xmake.lua
@@ -56,8 +56,20 @@ task("lua")
if not complete or opt.command or opt.list then
return
end
-
- return import("main.scripts")()
+ local list = import("main.scripts")()
+ if list and complete then
+ local result = {}
+ for _, item in ipairs(list) do
+ if item:startswith(complete) then
+ table.insert(result, item)
+ end
+ end
+ if #result > 0 then
+ return result
+ end
+ end
+ -- we just return nil and fallback to system autocomplete
+ -- it will complete file path, e.g. `xmake l scripts/test.lua`
end }
, {nil, "arguments" , "vs" , nil , "The script arguments, use '--deserialize' option to enable deserializing.",
"e.g.",