Skip to content

Commit c61d7db

Browse files
committed
Add postfix completion for unpack
1 parent 40fcae7 commit c61d7db

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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)