summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-29 09:47:21 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-29 09:47:21 +0800
commitdaa0b48c627cb1ed15a65e7e6330ca6c81627510 (patch)
tree3bdad898316e1c394c26f0d538595beef1123300 /server/src/core
parentb684462e3e1722454baf80f756c3b3a81c390053 (diff)
parentae5c35babefe1eca7a3c85db68ffb74ffc18abf1 (diff)
downloadlua-language-server-daa0b48c627cb1ed15a65e7e6330ca6c81627510.zip
Merge branch 'master' into global
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