Skip to content

Commit ec1f746

Browse files
committed
fix optional parameters
1 parent 6e00db5 commit ec1f746

File tree

17 files changed

+47
-36
lines changed

17 files changed

+47
-36
lines changed

meta/template/io.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function io.lines(filename, ...) end
4747

4848
---#DES 'io.open'
4949
---@param filename string
50-
---@param mode openmode
50+
---@param mode? openmode
5151
---@return file*?
5252
---@return string? errmsg
5353
---@nodiscard
@@ -157,7 +157,7 @@ function file:seek(whence, offset) end
157157

158158
---#DES 'file:setvbuf'
159159
---@param mode vbuf
160-
---@param size integer
160+
---@param size? integer
161161
function file:setvbuf(mode, size) end
162162

163163
---#DES 'file:write'

meta/template/string.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function string.gmatch(s, pattern, init) end
6565
---@param s string
6666
---@param pattern string
6767
---@param repl string|table|function
68-
---@param n integer
68+
---@param n? integer
6969
---@return string
7070
---@return integer count
7171
---@nodiscard

meta/template/table.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function table.remove(list, pos) end
5252
---#DES 'table.sort'
5353
---@generic T
5454
---@param list T[]
55-
---@param comp fun(a: T, b: T):boolean
55+
---@param comp? fun(a: T, b: T):boolean
5656
function table.sort(list, comp) end
5757

5858
---@version >5.2, JIT

script/client.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ local function tryModifyClientGlobal(finalChanges)
318318
end
319319

320320
---@param changes config.change[]
321-
---@param onlyMemory boolean
321+
---@param onlyMemory? boolean
322322
function m.setConfig(changes, onlyMemory)
323323
local finalChanges = {}
324324
for _, change in ipairs(changes) do

script/core/diagnostics/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ end
105105
---@param uri uri
106106
---@param isScopeDiag boolean
107107
---@param response async fun(result: any)
108-
---@param checked async fun(name: string)
108+
---@param checked? async fun(name: string)
109109
return function (uri, isScopeDiag, response, checked)
110110
local ast = files.getState(uri)
111111
if not ast then

script/core/diagnostics/missing-parameter.lua

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,7 @@ return function (uri, callback)
6969
callback {
7070
start = source.start,
7171
finish = source.finish,
72+
message = lang.script('DIAG_MISS_ARGS', funcArgs, callArgs),
7273
}
73-
for i = #source.args - delta + 1, #source.args do
74-
local arg = source.args[i]
75-
if arg then
76-
callback {
77-
start = arg.start,
78-
finish = arg.finish,
79-
message = lang.script('DIAG_MISS_ARGS', funcArgs, callArgs)
80-
}
81-
end
82-
end
8374
end)
8475
end

script/core/look-backward.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
local m = {}
33

44
--- 是否是空白符
5-
---@param inline boolean # 必须在同一行中(排除换行符)
5+
---@param char string
6+
---@param inline? boolean # 必须在同一行中(排除换行符)
67
function m.isSpace(char, inline)
78
if inline then
89
if char == ' '
@@ -21,7 +22,9 @@ function m.isSpace(char, inline)
2122
end
2223

2324
--- 跳过空白符
24-
---@param inline boolean # 必须在同一行中(排除换行符)
25+
---@param text string
26+
---@param offset integer
27+
---@param inline? boolean # 必须在同一行中(排除换行符)
2528
function m.skipSpace(text, offset, inline)
2629
for i = offset, 1, -1 do
2730
local char = text:sub(i, i)

script/core/matchkey.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ end
5959

6060
---@param input string
6161
---@param other string
62-
---@param fast boolean
62+
---@param fast? boolean
6363
---@return boolean isMatch
6464
---@return number deviation
6565
return function (input, other, fast)

script/encoder/init.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ local utf16be = utf16('be', utf8.codepoint '�')
1010
local m = {}
1111

1212
---@param encoding encoder.encoding
13-
---@param s string
14-
---@param i integer
15-
---@param j integer
13+
---@param s string
14+
---@param i? integer
15+
---@param j? integer
1616
function m.len(encoding, s, i, j)
1717
i = i or 1
1818
j = j or #s
@@ -33,9 +33,9 @@ function m.len(encoding, s, i, j)
3333
end
3434

3535
---@param encoding encoder.encoding
36-
---@param s string
37-
---@param n integer
38-
---@param i integer
36+
---@param s string
37+
---@param n integer
38+
---@param i? integer
3939
function m.offset(encoding, s, n, i)
4040
i = i or 1
4141
if encoding == 'utf16'

script/files.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ end
165165
--- 设置文件文本
166166
---@param uri uri
167167
---@param text string
168-
---@param isTrust boolean
169-
---@param callback function
168+
---@param isTrust? boolean
169+
---@param callback? function
170170
function m.setText(uri, text, isTrust, callback)
171171
if not text then
172172
return

0 commit comments

Comments
 (0)