diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-02 19:11:47 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-02 19:11:47 +0800 |
commit | 5f7221b244abd064e404431dc39b18ffd62bc3aa (patch) | |
tree | b046f8da4cc24e8b0433a682ca88ac211d50904a /script | |
parent | 3254ba0c91e682f7c2487c4633309c10a86c82c6 (diff) | |
download | lua-language-server-5f7221b244abd064e404431dc39b18ffd62bc3aa.zip |
fix #371 dont require meta from other version
Diffstat (limited to 'script')
-rw-r--r-- | script/library.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/script/library.lua b/script/library.lua index 09b14d25..723e871a 100644 --- a/script/library.lua +++ b/script/library.lua @@ -83,6 +83,7 @@ local function compileSingleMetaDoc(script, metaLang) jit = false end + local disable = false local env = setmetatable({ VERSION = version, JIT = jit, @@ -143,11 +144,17 @@ local function compileSingleMetaDoc(script, metaLang) compileBuf[#compileBuf+1] = '---@deprecated\n' end end, + DISABLE = function () + disable = true + end, }, { __index = _ENV }) util.saveFile((ROOT / 'log' / 'middleScript.lua'):string(), middleScript) assert(load(middleScript, middleScript, 't', env))() + if disable then + return nil + end return table.concat(compileBuf) end @@ -183,8 +190,12 @@ local function compileMetaDoc() local filename = fullpath:filename() local metaDoc = compileSingleMetaDoc(util.loadFile(fullpath:string()), metaLang) local filepath = metapath / filename - util.saveFile(filepath:string(), metaDoc) - m.metaPaths[#m.metaPaths+1] = filepath:string() + if metaDoc then + util.saveFile(filepath:string(), metaDoc) + m.metaPaths[#m.metaPaths+1] = filepath:string() + else + fs.remove(filepath) + end end end |