Skip to content

Commit a381f7b

Browse files
committed
Add postfix snippet for unpack
1 parent 40fcae7 commit a381f7b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44
<!-- Add all new changes here. They will be moved under a version at release -->
5+
* `NEW` Add postfix snippet for `unpack`
56

67
## 3.9.3
78
`2024-6-11`

script/core/completion/postfix.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,24 @@ register 'pairs' {
220220
end
221221
}
222222

223+
register 'unpack' {
224+
function (state, source, callback)
225+
if source.type ~= 'getglobal'
226+
and source.type ~= 'getfield'
227+
and source.type ~= 'getmethod'
228+
and source.type ~= 'getindex'
229+
and source.type ~= 'getlocal'
230+
and source.type ~= 'call'
231+
and source.type ~= 'table' then
232+
return
233+
end
234+
local subber = subString(state)
235+
callback(string.format('unpack(%s)'
236+
, subber(source.start + 1, source.finish)
237+
))
238+
end
239+
}
240+
223241
register 'insert' {
224242
function (state, source, callback)
225243
if source.type ~= 'getglobal'

0 commit comments

Comments
 (0)