diff options
author | sumneko <sumneko@hotmail.com> | 2019-05-06 19:43:43 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-05-06 19:43:43 +0800 |
commit | ce0e466279ccd237ec8b3df5e7ed9275b166e1c7 (patch) | |
tree | 765108bf350103345f4538b73e237bf016fce660 /server/src/emmy | |
parent | df62d7a467cc2ffa1d4945c4912a4568baf75847 (diff) | |
download | lua-language-server-ce0e466279ccd237ec8b3df5e7ed9275b166e1c7.zip |
param支持字面量
Diffstat (limited to 'server/src/emmy')
-rw-r--r-- | server/src/emmy/manager.lua | 3 | ||||
-rw-r--r-- | server/src/emmy/param.lua | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/server/src/emmy/manager.lua b/server/src/emmy/manager.lua index 128ed029..85f25bd1 100644 --- a/server/src/emmy/manager.lua +++ b/server/src/emmy/manager.lua @@ -138,6 +138,9 @@ function mt:addParam(source, bind) elseif bind.type == 'emmy.generic' then paramObj:bindGeneric(bind) end + for i = 3, #source do + paramObj:addEnum(source[i][1]) + end return paramObj end diff --git a/server/src/emmy/param.lua b/server/src/emmy/param.lua index 9a2d407f..5894e28e 100644 --- a/server/src/emmy/param.lua +++ b/server/src/emmy/param.lua @@ -29,10 +29,21 @@ function mt:bindGeneric(generic) end end +function mt:addEnum(str) + self._enum[#self._enum+1] = str +end + +function mt:eachEnum(callback) + for _, str in ipairs(self._enum) do + callback(str) + end +end + return function (manager, source) local self = setmetatable({ source = source.id, _manager = manager, + _enum = {}, }, mt) if source.type == 'emmyParam' then self.name = source[1][1] |