diff --git a/changelog.md b/changelog.md index 8ddfed5f5..bd7981be5 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## Unreleased +* `NEW` Add postfix snippet for `unpack` ## 3.9.3 `2024-6-11` diff --git a/script/core/completion/postfix.lua b/script/core/completion/postfix.lua index 1331a0e4c..b5f333153 100644 --- a/script/core/completion/postfix.lua +++ b/script/core/completion/postfix.lua @@ -220,6 +220,24 @@ register 'pairs' { end } +register 'unpack' { + function (state, source, callback) + if source.type ~= 'getglobal' + and source.type ~= 'getfield' + and source.type ~= 'getmethod' + and source.type ~= 'getindex' + and source.type ~= 'getlocal' + and source.type ~= 'call' + and source.type ~= 'table' then + return + end + local subber = subString(state) + callback(string.format('unpack(%s)' + , subber(source.start + 1, source.finish) + )) + end +} + register 'insert' { function (state, source, callback) if source.type ~= 'getglobal'