diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-15 21:07:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-15 21:07:14 +0800 |
commit | 9bde1d4431a466e894a81b533a3a037b9e574305 (patch) | |
tree | 6ce24ce672fbdf97c0a1592f461d5df4e562e259 /script/library.lua | |
parent | b552559036d6a635d51ea27da0b59fa9150ac27f (diff) | |
download | lua-language-server-9bde1d4431a466e894a81b533a3a037b9e574305.zip |
improve setting
Diffstat (limited to 'script/library.lua')
-rw-r--r-- | script/library.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/script/library.lua b/script/library.lua index e643e2ec..a2b400bf 100644 --- a/script/library.lua +++ b/script/library.lua @@ -5,6 +5,7 @@ local lang = require 'language' local client = require 'provider.client' local lloader = require 'locale-loader' local fsu = require 'fs-utility' +local define = require "proto.define" local m = {} @@ -76,7 +77,7 @@ local function createViewDocument(name) return ('[%s](%s)'):format(lang.script.HOVER_VIEW_DOCUMENTS, lang.script(fmt, 'pdf-' .. name)) end -local function compileSingleMetaDoc(script, metaLang) +local function compileSingleMetaDoc(script, metaLang, status) if not script then return nil end @@ -170,7 +171,7 @@ local function compileSingleMetaDoc(script, metaLang) util.saveFile((ROOT / 'log' / 'middleScript.lua'):string(), middleScript) assert(load(middleScript, middleScript, 't', env))() - if disable then + if disable and status == 'default' then return nil end return table.concat(compileBuf) @@ -205,13 +206,14 @@ local function compileMetaDoc() fs.create_directories(metaPath) local out = fsu.dummyFS() local templateDir = ROOT / 'meta' / 'template' - for libName, status in pairs(config.config.runtime.builtin) do - if status ~= 'enable' then + for libName, status in pairs(define.BuiltIn) do + status = config.config.runtime.builtin[libName] or status + if status == 'disable' then goto CONTINUE end libName = libName .. '.lua' local libPath = templateDir / libName - local metaDoc = compileSingleMetaDoc(fsu.loadFile(libPath), metaLang) + local metaDoc = compileSingleMetaDoc(fsu.loadFile(libPath), metaLang, status) if metaDoc then local outPath = metaPath / libName out:saveFile(libName, metaDoc) |