diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-13 16:27:10 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-13 16:27:10 +0800 |
commit | 50c78c90cdfc188ab473bd12e17752d2101d5f05 (patch) | |
tree | c896112142e9ee44af55330b21d401e53f263c2a | |
parent | c3e280a5bc556cb8ff87a6b0fc6f7a7c48292d4d (diff) | |
download | lua-language-server-50c78c90cdfc188ab473bd12e17752d2101d5f05.zip |
修正一些问题
-rw-r--r-- | meta/template/basic.lua | 2 | ||||
-rw-r--r-- | meta/template/io.lua | 6 | ||||
-rw-r--r-- | meta/template/package.lua | 2 | ||||
-rw-r--r-- | script-beta/core/diagnostics/doc-field-no-class.lua | 23 | ||||
-rw-r--r-- | script-beta/library.lua | 2 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 4 | ||||
-rw-r--r-- | test-beta/diagnostics/init.lua | 12 |
7 files changed, 34 insertions, 17 deletions
diff --git a/meta/template/basic.lua b/meta/template/basic.lua index 1e86d828..c58d09b7 100644 --- a/meta/template/basic.lua +++ b/meta/template/basic.lua @@ -145,7 +145,7 @@ function setmetatable(table, metatable) end ---@param e string|number ---@param base integer? ----@return number|nil +---@return number? function tonumber(e, base) end ---@param v any diff --git a/meta/template/io.lua b/meta/template/io.lua index c0d1689c..90354b64 100644 --- a/meta/template/io.lua +++ b/meta/template/io.lua @@ -35,6 +35,12 @@ function io.input(file) end ---@return fun():string|number function io.lines(filename, ...) end +---@param filename string +---@param mode openmode +---@return file? +---@return string errmsg? +function io.open(filename, mode) end + ---@overload fun():file ---@param file string|file function io.output(file) end diff --git a/meta/template/package.lua b/meta/template/package.lua index 7970e2ca..a133a4f6 100644 --- a/meta/template/package.lua +++ b/meta/template/package.lua @@ -17,7 +17,7 @@ function package.loadlib(libname, funcname) end ---@param path string ---@param sep string? ---@param rep string? ----@return string|nil filename +---@return string filename? ---@return string errmsg? function package.searchpath(name, path, sep, rep) end diff --git a/script-beta/core/diagnostics/doc-field-no-class.lua b/script-beta/core/diagnostics/doc-field-no-class.lua index 88c61824..f27bbb32 100644 --- a/script-beta/core/diagnostics/doc-field-no-class.lua +++ b/script-beta/core/diagnostics/doc-field-no-class.lua @@ -23,19 +23,18 @@ return function (uri, callback) for _, other in ipairs(bindGroup) do if other.type == 'doc.class' then ok = true - elseif other == doc then - if not ok then - callback { - start = doc.start, - finish = doc.finish, - message = lang.script('DIAG_DOC_FIELD_NO_CLASS'), - } - end - goto CONTINUE - elseif other.type == 'doc.field' then - else - ok = false + break end + if other == doc then + break + end + end + if not ok then + callback { + start = doc.start, + finish = doc.finish, + message = lang.script('DIAG_DOC_FIELD_NO_CLASS'), + } end ::CONTINUE:: end diff --git a/script-beta/library.lua b/script-beta/library.lua index 78321d6a..a4741fd1 100644 --- a/script-beta/library.lua +++ b/script-beta/library.lua @@ -315,7 +315,7 @@ local function compileMetaDoc() language = langID, }) if fs.exists(m.metapath) then - return + --return end fs.create_directory(m.metapath) local templateDir = ROOT / 'meta' / 'template' diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 288a0381..b85d10d8 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -806,8 +806,8 @@ end ---@param a table ---@param b table ---@return string|boolean mode ----@return table|nil pathA ----@return table|nil pathB +---@return table pathA? +---@return table pathB? function m.getPath(a, b, sameFunction) --- 首先测试双方在同一个函数内 if sameFunction and m.getParentFunction(a) ~= m.getParentFunction(b) then diff --git a/test-beta/diagnostics/init.lua b/test-beta/diagnostics/init.lua index 4fe96ec4..e32ef275 100644 --- a/test-beta/diagnostics/init.lua +++ b/test-beta/diagnostics/init.lua @@ -720,6 +720,18 @@ TEST [[ TEST [[ ---@class Class + +---@field <!x Class!> +]] + +TEST [[ +---@class Class +--- +---@field x Class +]] + +TEST [[ +---@class Class ---@field x Class ---@field <!x!> Class ]] |