diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-01-28 17:43:40 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-01-28 17:43:40 +0800 |
commit | c427477428c0c1d583f42c0e7784684b8f713a6e (patch) | |
tree | 6944c9dbb52ac02e26a5a1df39451187d6ee260e /server/src/core/library.lua | |
parent | 4418abe11364b4ebf7dc205bb27811b8c7197b88 (diff) | |
download | lua-language-server-c427477428c0c1d583f42c0e7784684b8f713a6e.zip |
使用新的过滤器
Diffstat (limited to 'server/src/core/library.lua')
-rw-r--r-- | server/src/core/library.lua | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/server/src/core/library.lua b/server/src/core/library.lua index b268b368..6bceadc4 100644 --- a/server/src/core/library.lua +++ b/server/src/core/library.lua @@ -144,6 +144,24 @@ local function fix(libs) end end +local function scan(path) + local result = {path} + local i = 0 + return function () + i = i + 1 + local current = result[i] + if not current then + return nil + end + if fs.is_directory(current) then + for path in current:list_directory() do + result[#result+1] = path + end + end + return current + end +end + local function init() local lang = require 'language' local id = lang.id @@ -152,7 +170,7 @@ local function init() library = table.container(), object = table.container(), } - for path in io.scan(ROOT / 'libs') do + for path in scan(ROOT / 'libs') do local libs local buf = io.load(path) if buf then |