diff options
author | Yi Ming <ofseed@foxmail.com> | 2024-06-20 02:48:27 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2024-06-25 17:13:46 +0800 |
commit | ffee37bfb5a2cc34ccd7eec8a819146b53ac4763 (patch) | |
tree | c46412cd95d11b24b89639cb37fc78e3d580da7b /script/core/completion | |
parent | 40fcae7f4c90e4fba78d5ea44fc94b93b20e0c09 (diff) | |
download | lua-language-server-ffee37bfb5a2cc34ccd7eec8a819146b53ac4763.zip |
Add postfix snippet for `unpack`
Diffstat (limited to 'script/core/completion')
-rw-r--r-- | script/core/completion/postfix.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/script/core/completion/postfix.lua b/script/core/completion/postfix.lua index 1331a0e4..b5f33315 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' |