diff options
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | meta/template/bit.lua | 1 | ||||
-rw-r--r-- | meta/template/bit32.lua | 1 | ||||
-rw-r--r-- | meta/template/ffi.lua | 1 | ||||
-rw-r--r-- | meta/template/jit.lua | 1 | ||||
-rw-r--r-- | meta/template/utf8.lua | 1 | ||||
-rw-r--r-- | script/library.lua | 15 |
7 files changed, 19 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md index ae7d16cc..9d642e24 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,7 @@ * `CHG` `LuaDoc`: compatible with `--@` * `FIX` `VSCode` settings * `FIX` [#368](https://github.com/sumneko/lua-language-server/issues/368) +* `FIX` [#371](https://github.com/sumneko/lua-language-server/issues/371) ## 1.13.0 `2021-1-28` diff --git a/meta/template/bit.lua b/meta/template/bit.lua index 09b69194..c50e47e5 100644 --- a/meta/template/bit.lua +++ b/meta/template/bit.lua @@ -1,3 +1,4 @@ +---#if not JIT then DISABLE() end ---@meta ---@version JIT diff --git a/meta/template/bit32.lua b/meta/template/bit32.lua index 25e4b27a..19686541 100644 --- a/meta/template/bit32.lua +++ b/meta/template/bit32.lua @@ -1,3 +1,4 @@ +---#if VERSION ~= 5.2 then DISABLE() end ---@meta ---@version 5.2 diff --git a/meta/template/ffi.lua b/meta/template/ffi.lua index 7ffe0e47..8e7137e4 100644 --- a/meta/template/ffi.lua +++ b/meta/template/ffi.lua @@ -1,3 +1,4 @@ +---#if not JIT then DISABLE() end ---@meta ---@class ffi.namespace*: table diff --git a/meta/template/jit.lua b/meta/template/jit.lua index 560e1264..9580c0e3 100644 --- a/meta/template/jit.lua +++ b/meta/template/jit.lua @@ -1,3 +1,4 @@ +---#if not JIT then DISABLE() end ---@meta ---@version JIT diff --git a/meta/template/utf8.lua b/meta/template/utf8.lua index 1cc35361..52dbe5be 100644 --- a/meta/template/utf8.lua +++ b/meta/template/utf8.lua @@ -1,3 +1,4 @@ +---#if VERSION <= 5.2 then DISABLE() end ---@meta ---@version >5.3 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 |