diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-28 18:25:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-28 18:25:39 +0800 |
commit | 2a86ea3fc9114ca5e269dab1270d86b1fec98119 (patch) | |
tree | 8d304e6a3e75e025f66e387863c81b24b8b10259 /script-beta/library.lua | |
parent | c7102d92354176d99ddfe265e199d370065b4ee8 (diff) | |
download | lua-language-server-2a86ea3fc9114ca5e269dab1270d86b1fec98119.zip |
整理library
Diffstat (limited to 'script-beta/library.lua')
-rw-r--r-- | script-beta/library.lua | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/script-beta/library.lua b/script-beta/library.lua index 038e19fa..a1416fb4 100644 --- a/script-beta/library.lua +++ b/script-beta/library.lua @@ -258,10 +258,13 @@ end local function markLibrary(library) for _, lib in pairs(library) do lib.library = true - lib.start = 0 - lib.finish = 0 + lib.fields = {} if lib.child then - markLibrary(lib.child) + for _, child in util.sortPairs(lib.child) do + table.insert(lib.fields, child) + child.library = true + child.parent = library + end end end end @@ -269,11 +272,11 @@ end local function init() local lang = require 'language' local id = lang.id - m.global = util.container() - m.library = util.container() - m.object = util.container() - m.other = util.container() - m.custom = util.container() + m.global = {} + m.library = {} + m.object = {} + m.other = {} + m.custom = {} for libPath in (ROOT / 'libs'):list_directory() do local libName = libPath:filename():string() @@ -281,7 +284,7 @@ local function init() local libs local buf = util.loadFile(path:string()) if buf then - libs = util.container() + libs = {} xpcall(lni, log.error, buf, path:string(), {libs}) fix(libs) end |