diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-16 15:31:34 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-16 15:31:34 +0800 |
commit | 4d55cca4a73e9cb3a072562ecbd89ebf6c172c0b (patch) | |
tree | e404bf7ba5d404a6a1e051dc50b63022c9e1ad48 /server | |
parent | f406daaa8633afb61078a060b509c32675b6f612 (diff) | |
download | lua-language-server-4d55cca4a73e9cb3a072562ecbd89ebf6c172c0b.zip |
支持自定义path
Diffstat (limited to 'server')
-rw-r--r-- | server/src/config.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/server/src/config.lua b/server/src/config.lua index c155eab2..125ac655 100644 --- a/server/src/config.lua +++ b/server/src/config.lua @@ -38,10 +38,34 @@ local function Str2Hash(sep) end end +local function Array(checker) + return function (tbl) + if type(tbl) ~= 'table' then + return false + end + local t = {} + for _, v in ipairs(tbl) do + local ok, result = checker(v) + if ok then + t[#t+1] = result + end + end + if #t == 0 then + return false + end + return true, t + end +end + local Template = { runtime = { version = {'Lua 5.3', String}, library = {{}, Str2Hash ';'}, + path = {{ + "?.lua", + "?/init.lua", + "?/?.lua" + }, Array(String)}, }, diagnostics = { globals = {{}, Str2Hash ';'}, |