Skip to content

Commit 30f04a9

Browse files
committed
3.8.0
1 parent f164acf commit 30f04a9

13 files changed

+163
-39
lines changed

changelog.md

+73
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,69 @@
11
# changelog
22

3+
## 3.8.0
4+
`2024-4-22`
5+
* `NEW` supports tuple type (@[lizho])
6+
```lua
7+
---@type [string, number, boolean]
8+
local t
9+
10+
local x = t[1] --> x is `string`
11+
local y = t[2] --> y is `number`
12+
local z = t[3] --> z is `boolean`
13+
```
14+
* `NEW` generic pattern (@[fesily])
15+
```lua
16+
---@generic T
17+
---@param t Cat.`T`
18+
---@return T
19+
local function f(t) end
20+
21+
local t = f('Smile') --> t is `Cat.Smile`
22+
```
23+
* `NEW` alias and enums supports attribute `partial`
24+
```lua
25+
---@alias Animal Cat
26+
27+
---@alias(partial) Animal Dog
28+
29+
---@type Animal
30+
local animal --> animal is `Cat|Dog` here
31+
```
32+
33+
```lua
34+
---@enum(key) ErrorCodes
35+
local codes1 = {
36+
OK = 0,
37+
ERROR = 1,
38+
FATAL = 2,
39+
}
40+
41+
---@enum(key, partial) ErrorCodes
42+
local codes2 = {
43+
WARN = 3,
44+
INFO = 4,
45+
}
46+
47+
---@type ErrorCodes
48+
local code
49+
50+
code = 'ERROR' --> OK
51+
code = 'WARN' --> OK
52+
53+
```
54+
* `NEW` plugin: add `OnTransFormAst` interface (@[fesily])
55+
* `NEW` plugin: add `OnNodeCompileFunctionParam` interface (@[fesily])
56+
* `NEW` plugin: add `ResolveRequire` interface (@[Artem Dzhemesiuk])
57+
* `NEW` plugin: support multi plugins (@[fesily])
58+
+ setting: `Lua.runtime.plugin` can be `string|string[]`
59+
+ setting: `Lua.runtime.pluginArgs` can be `string[]|table<string, string>`
60+
* `NEW` CLI: `--doc` add option `--doc_out_path <PATH>` (@[Andreas Matthias])
61+
* `NEW` CLI: `--doc_update`, update an existing `doc.json` without using `--doc` again (@[Andreas Matthias])
62+
* `NEW` CLI: `--trust_all_plugins`, this is potentially unsafe for normal use and meant for usage in CI environments only (@[Paul Emmerich])
63+
* `CHG` CLI: `--check` will run plugins (@[Daniel Farrell])
64+
* `FIX` diagnostic: `discard-returns` not works in some blocks (@clay-golem)
65+
* `FIX` rename in library files
66+
367
## 3.7.4
468
`2024-1-5`
569
* `FIX` rename to unicode with `Lua.runtime.unicodeName = true`
@@ -1963,3 +2027,12 @@ f( -- view comments of `1` and `2` in completion
19632027
`2020-11-9`
19642028

19652029
* `NEW` implementation, NEW start!
2030+
2031+
<!-- contributors -->
2032+
[lizho]: (https://github.com/lizho)
2033+
[fesily]: (https://github.com/fesily)
2034+
[Andreas Matthias]: (https://github.com/AndreasMatthias)
2035+
[Daniel Farrell]: (https://github.com/danpf)
2036+
[Paul Emmerich]: (https://github.com/emmericp)
2037+
[Artem Dzhemesiuk]: (https://github.com/zziger)
2038+
[clay-golem]: (https://github.com/clay-golem)

package.json

+15-8
Original file line numberDiff line numberDiff line change
@@ -2925,19 +2925,20 @@
29252925
"type": "boolean"
29262926
},
29272927
"Lua.runtime.plugin": {
2928-
"default": "",
29292928
"markdownDescription": "%config.runtime.plugin%",
29302929
"scope": "resource",
2931-
"type": "string"
2930+
"type": [
2931+
"string",
2932+
"array"
2933+
]
29322934
},
29332935
"Lua.runtime.pluginArgs": {
2934-
"default": [],
2935-
"items": {
2936-
"type": "string"
2937-
},
29382936
"markdownDescription": "%config.runtime.pluginArgs%",
29392937
"scope": "resource",
2940-
"type": "array"
2938+
"type": [
2939+
"array",
2940+
"object"
2941+
]
29412942
},
29422943
"Lua.runtime.special": {
29432944
"additionalProperties": false,
@@ -3039,6 +3040,12 @@
30393040
"scope": "resource",
30403041
"type": "boolean"
30413042
},
3043+
"Lua.type.inferParamType": {
3044+
"default": false,
3045+
"markdownDescription": "%config.type.inferParamType%",
3046+
"scope": "resource",
3047+
"type": "boolean"
3048+
},
30423049
"Lua.type.weakNilCheck": {
30433050
"default": false,
30443051
"markdownDescription": "%config.type.weakNilCheck%",
@@ -3343,5 +3350,5 @@
33433350
"sponsor": {
33443351
"url": "https://github.com/LuaLS/lua-language-server/issues/484"
33453352
},
3346-
"version": "3.7.4"
3353+
"version": "3.8.0"
33473354
}

package.nls.json

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"config.spell.dict": "Custom words for spell checking.",
212212
"config.telemetry.enable": "Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://luals.github.io/privacy/#language-server).\n",
213213
"config.type.castNumberToInteger": "Allowed to assign the `number` type to the `integer` type.",
214+
"config.type.inferParamType": "When a parameter type is not annotated, it is inferred from the function's call sites.\n\nWhen this setting is `false`, the type of the parameter is `any` when it is not annotated.\n",
214215
"config.type.weakNilCheck": "When checking the type of union type, ignore the `nil` in it.\n\nWhen this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.\n",
215216
"config.type.weakUnionCheck": "Once one subtype of a union type meets the condition, the union type also meets the condition.\n\nWhen this setting is `false`, the `number|boolean` type cannot be assigned to the `number` type. It can be with `true`.\n",
216217
"config.typeFormat.config": "Configures the formatting behavior while typing Lua code.",

package.nls.pt-br.json

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"config.spell.dict": "Custom words for spell checking.",
212212
"config.telemetry.enable": "Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://luals.github.io/privacy/#language-server).\n",
213213
"config.type.castNumberToInteger": "Allowed to assign the `number` type to the `integer` type.",
214+
"config.type.inferParamType": "When the parameter type is not annotated, the parameter type is inferred from the function's incoming parameters.\n\nWhen this setting is `false`, the type of the parameter is `any` when it is not annotated.\n",
214215
"config.type.weakNilCheck": "When checking the type of union type, ignore the `nil` in it.\n\nWhen this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.\n",
215216
"config.type.weakUnionCheck": "Once one subtype of a union type meets the condition, the union type also meets the condition.\n\nWhen this setting is `false`, the `number|boolean` type cannot be assigned to the `number` type. It can be with `true`.\n",
216217
"config.typeFormat.config": "Configures the formatting behavior while typing Lua code.",

package.nls.zh-cn.json

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"config.spell.dict": "拼写检查的自定义单词。",
212212
"config.telemetry.enable": "启用遥测,通过网络发送你的编辑器信息与错误日志。在[此处](https://luals.github.io/privacy/#language-server)阅读我们的隐私声明。\n",
213213
"config.type.castNumberToInteger": "允许将 `number` 类型赋给 `integer` 类型。",
214+
"config.type.inferParamType": "未注释参数类型时,参数类型由函数传入参数推断。\n\n如果设置为 \"false\",则在未注释时,参数类型为 \"any\"\n",
214215
"config.type.weakNilCheck": "对联合类型进行类型检查时,忽略其中的 `nil`。\n\n此设置为 `false` 时,`numer|nil` 类型无法赋给 `number` 类型;为 `true` 是则可以。\n",
215216
"config.type.weakUnionCheck": "联合类型中只要有一个子类型满足条件,则联合类型也满足条件。\n\n此设置为 `false` 时,`number|boolean` 类型无法赋给 `number` 类型;为 `true` 时则可以。\n",
216217
"config.typeFormat.config": "配置输入Lua代码时的格式化行为",

package.nls.zh-tw.json

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
"config.spell.dict": "拼寫檢查的自訂單詞。",
212212
"config.telemetry.enable": "啟用遙測,透過網路發送你的編輯器資訊與錯誤日誌。在[此處](https://luals.github.io/privacy/#language-server)閱讀我們的隱私聲明。\n",
213213
"config.type.castNumberToInteger": "允許將 `number` 類型賦值給 `integer` 類型。",
214+
"config.type.inferParamType": "未注释参数类型时,参数类型由函数传入参数推断。\n\n如果设置为 \"false\",则在未注释时,参数类型为 \"any\"\n",
214215
"config.type.weakNilCheck": "When checking the type of union type, ignore the `nil` in it.\n\nWhen this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.\n",
215216
"config.type.weakUnionCheck": "同位類型中只要有一個子類型滿足條件,則同位類型也滿足條件。\n\n此設定為 `false` 時,`number|boolean` 類型無法賦給 `number` 類型;為 `true` 時則可以。\n",
216217
"config.typeFormat.config": "Configures the formatting behavior while typing Lua code.",

package/build.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local json = require 'json-beautify'
22

3-
local VERSION = "3.7.4"
3+
local VERSION = "3.8.0"
44

55
local package = require 'package.package'
66
local fsu = require 'fs-utility'

publish.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ local function copyFiles(root, out)
6464
end
6565

6666
local function runTest(root)
67-
local ext = platform.OS == 'Windows' and '.exe' or ''
67+
local ext = platform.os == 'windows' and '.exe' or ''
6868
local exe = root / 'bin' / 'lua-language-server' .. ext
6969
local test = root / 'test.lua'
7070
local lua = subprocess.spawn {

setting/schema-pt-br.json

+17-7
Original file line numberDiff line numberDiff line change
@@ -3106,19 +3106,20 @@
31063106
"type": "boolean"
31073107
},
31083108
"runtime.plugin": {
3109-
"default": "",
31103109
"markdownDescription": "Plugin path. Please read [wiki](https://luals.github.io/wiki/plugins) to learn more.",
31113110
"scope": "resource",
3112-
"type": "string"
3111+
"type": [
3112+
"string",
3113+
"array"
3114+
]
31133115
},
31143116
"runtime.pluginArgs": {
3115-
"default": [],
3116-
"items": {
3117-
"type": "string"
3118-
},
31193117
"markdownDescription": "Additional arguments for the plugin.",
31203118
"scope": "resource",
3121-
"type": "array"
3119+
"type": [
3120+
"array",
3121+
"object"
3122+
]
31223123
},
31233124
"runtime.special": {
31243125
"additionalProperties": false,
@@ -3249,6 +3250,9 @@
32493250
"castNumberToInteger": {
32503251
"$ref": "#/properties/type.castNumberToInteger"
32513252
},
3253+
"inferParamType": {
3254+
"$ref": "#/properties/type.inferParamType"
3255+
},
32523256
"weakNilCheck": {
32533257
"$ref": "#/properties/type.weakNilCheck"
32543258
},
@@ -3263,6 +3267,12 @@
32633267
"scope": "resource",
32643268
"type": "boolean"
32653269
},
3270+
"type.inferParamType": {
3271+
"default": false,
3272+
"markdownDescription": "When the parameter type is not annotated, the parameter type is inferred from the function's incoming parameters.\n\nWhen this setting is `false`, the type of the parameter is `any` when it is not annotated.\n",
3273+
"scope": "resource",
3274+
"type": "boolean"
3275+
},
32663276
"type.weakNilCheck": {
32673277
"default": false,
32683278
"markdownDescription": "When checking the type of union type, ignore the `nil` in it.\n\nWhen this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.\n",

setting/schema-zh-cn.json

+17-7
Original file line numberDiff line numberDiff line change
@@ -3106,19 +3106,20 @@
31063106
"type": "boolean"
31073107
},
31083108
"runtime.plugin": {
3109-
"default": "",
31103109
"markdownDescription": "插件路径,请查阅[文档](https://luals.github.io/wiki/plugins)了解用法。",
31113110
"scope": "resource",
3112-
"type": "string"
3111+
"type": [
3112+
"string",
3113+
"array"
3114+
]
31133115
},
31143116
"runtime.pluginArgs": {
3115-
"default": [],
3116-
"items": {
3117-
"type": "string"
3118-
},
31193117
"markdownDescription": "Additional arguments for the plugin.",
31203118
"scope": "resource",
3121-
"type": "array"
3119+
"type": [
3120+
"array",
3121+
"object"
3122+
]
31223123
},
31233124
"runtime.special": {
31243125
"additionalProperties": false,
@@ -3249,6 +3250,9 @@
32493250
"castNumberToInteger": {
32503251
"$ref": "#/properties/type.castNumberToInteger"
32513252
},
3253+
"inferParamType": {
3254+
"$ref": "#/properties/type.inferParamType"
3255+
},
32523256
"weakNilCheck": {
32533257
"$ref": "#/properties/type.weakNilCheck"
32543258
},
@@ -3263,6 +3267,12 @@
32633267
"scope": "resource",
32643268
"type": "boolean"
32653269
},
3270+
"type.inferParamType": {
3271+
"default": false,
3272+
"markdownDescription": "未注释参数类型时,参数类型由函数传入参数推断。\n\n如果设置为 \"false\",则在未注释时,参数类型为 \"any\"\n",
3273+
"scope": "resource",
3274+
"type": "boolean"
3275+
},
32663276
"type.weakNilCheck": {
32673277
"default": false,
32683278
"markdownDescription": "对联合类型进行类型检查时,忽略其中的 `nil`。\n\n此设置为 `false` 时,`numer|nil` 类型无法赋给 `number` 类型;为 `true` 是则可以。\n",

setting/schema-zh-tw.json

+17-7
Original file line numberDiff line numberDiff line change
@@ -3106,19 +3106,20 @@
31063106
"type": "boolean"
31073107
},
31083108
"runtime.plugin": {
3109-
"default": "",
31103109
"markdownDescription": "延伸模組路徑,請查閱[文件](https://luals.github.io/wiki/plugins)瞭解用法。",
31113110
"scope": "resource",
3112-
"type": "string"
3111+
"type": [
3112+
"string",
3113+
"array"
3114+
]
31133115
},
31143116
"runtime.pluginArgs": {
3115-
"default": [],
3116-
"items": {
3117-
"type": "string"
3118-
},
31193117
"markdownDescription": "Additional arguments for the plugin.",
31203118
"scope": "resource",
3121-
"type": "array"
3119+
"type": [
3120+
"array",
3121+
"object"
3122+
]
31223123
},
31233124
"runtime.special": {
31243125
"additionalProperties": false,
@@ -3249,6 +3250,9 @@
32493250
"castNumberToInteger": {
32503251
"$ref": "#/properties/type.castNumberToInteger"
32513252
},
3253+
"inferParamType": {
3254+
"$ref": "#/properties/type.inferParamType"
3255+
},
32523256
"weakNilCheck": {
32533257
"$ref": "#/properties/type.weakNilCheck"
32543258
},
@@ -3263,6 +3267,12 @@
32633267
"scope": "resource",
32643268
"type": "boolean"
32653269
},
3270+
"type.inferParamType": {
3271+
"default": false,
3272+
"markdownDescription": "未注释参数类型时,参数类型由函数传入参数推断。\n\n如果设置为 \"false\",则在未注释时,参数类型为 \"any\"\n",
3273+
"scope": "resource",
3274+
"type": "boolean"
3275+
},
32663276
"type.weakNilCheck": {
32673277
"default": false,
32683278
"markdownDescription": "When checking the type of union type, ignore the `nil` in it.\n\nWhen this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.\n",

setting/schema.json

+17-7
Original file line numberDiff line numberDiff line change
@@ -3106,19 +3106,20 @@
31063106
"type": "boolean"
31073107
},
31083108
"runtime.plugin": {
3109-
"default": "",
31103109
"markdownDescription": "Plugin path. Please read [wiki](https://luals.github.io/wiki/plugins) to learn more.",
31113110
"scope": "resource",
3112-
"type": "string"
3111+
"type": [
3112+
"string",
3113+
"array"
3114+
]
31133115
},
31143116
"runtime.pluginArgs": {
3115-
"default": [],
3116-
"items": {
3117-
"type": "string"
3118-
},
31193117
"markdownDescription": "Additional arguments for the plugin.",
31203118
"scope": "resource",
3121-
"type": "array"
3119+
"type": [
3120+
"array",
3121+
"object"
3122+
]
31223123
},
31233124
"runtime.special": {
31243125
"additionalProperties": false,
@@ -3249,6 +3250,9 @@
32493250
"castNumberToInteger": {
32503251
"$ref": "#/properties/type.castNumberToInteger"
32513252
},
3253+
"inferParamType": {
3254+
"$ref": "#/properties/type.inferParamType"
3255+
},
32523256
"weakNilCheck": {
32533257
"$ref": "#/properties/type.weakNilCheck"
32543258
},
@@ -3263,6 +3267,12 @@
32633267
"scope": "resource",
32643268
"type": "boolean"
32653269
},
3270+
"type.inferParamType": {
3271+
"default": false,
3272+
"markdownDescription": "When a parameter type is not annotated, it is inferred from the function's call sites.\n\nWhen this setting is `false`, the type of the parameter is `any` when it is not annotated.\n",
3273+
"scope": "resource",
3274+
"type": "boolean"
3275+
},
32663276
"type.weakNilCheck": {
32673277
"default": false,
32683278
"markdownDescription": "When checking the type of union type, ignore the `nil` in it.\n\nWhen this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.\n",

0 commit comments

Comments
 (0)