summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-28 17:43:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-28 17:43:40 +0800
commitc427477428c0c1d583f42c0e7784684b8f713a6e (patch)
tree6944c9dbb52ac02e26a5a1df39451187d6ee260e /server/src/core
parent4418abe11364b4ebf7dc205bb27811b8c7197b88 (diff)
downloadlua-language-server-c427477428c0c1d583f42c0e7784684b8f713a6e.zip
使用新的过滤器
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/library.lua20
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