Skip to content

Commit f27e8a6

Browse files
committed
update version
1 parent 040022f commit f27e8a6

File tree

8 files changed

+284
-98
lines changed

8 files changed

+284
-98
lines changed

CHANGELOG.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,85 @@
22

33
[中文Log](CHANGELOG_CN.md)
44

5+
## [0.9.32] - 2025-11-10
6+
### 🔧 Changed
7+
- **Refactor IndexAliasName**: Removed the original index alias implementation (`-- [IndexAliasName]`), now use `---@[index_alias("name")]`.
8+
- **Refactor ClassDefaultCall**: Removed the configuration item `runtime.class_default_call`, now use `---@[constructor("<constructor_method_name>")]`.
9+
- **Rename ParamTypeNotMatch to ParamTypeMismatch**: Renamed the diagnostic `ParamTypeNotMatch` to `ParamTypeMismatch` for better clarity.
10+
- **Optimize comment parsing logic**: Comments now preserve leading spaces at the start of each line, maintaining the original formatting as much as possible when returned to the LSP client.
11+
12+
13+
### ✨ Added
14+
- **Attribute**: Introduced the new feature `---@attribute` for defining additional metadata, with several built-in attributes:
15+
```lua
16+
--- Deprecated. Accepts an optional message parameter.
17+
---@attribute deprecated(message: string?)
18+
19+
--- Language Server Optimization Items.
20+
---
21+
--- Parameters:
22+
--- - `check_table_field`: Skips assignment checks for table fields. Recommended for large configuration tables.
23+
--- - `delayed_definition`: Indicates the variable type is determined by the first assignment.
24+
--- Only valid for `local` declarations without an initial value.
25+
---@attribute lsp_optimization(code: "check_table_field"|"delayed_definition")
26+
27+
--- Index field alias, displayed in `hint` and `completion`.
28+
---
29+
--- Accepts a string parameter for the alias name.
30+
---@attribute index_alias(name: string)
31+
32+
--- This attribute must be applied to function parameters, and the parameter type must be a string template generic.
33+
--- Used to specify the default constructor of a class.
34+
---
35+
--- Parameters:
36+
--- - `name`: The method name as a constructor.
37+
--- - `root_class`: Marks the root class, will be implicitly inherited, e.g., `System.Object` in C#. Defaults to empty.
38+
--- - `strip_self`: Whether the `self` parameter can be omitted when calling the constructor, defaults to `true`.
39+
--- - `return_self`: Whether the constructor is forced to return `self`, defaults to `true`.
40+
---@attribute constructor(name: string, root_class: string?, strip_self: boolean?, return_self: boolean?)
41+
42+
--- Associates `getter` and `setter` methods with a field. Currently only provides definition navigation functionality.
43+
--- The target methods must be within the same class.
44+
---
45+
--- Parameters:
46+
--- - `convention`: Naming convention, defaults to `camelCase`. Implicitly adds `get` and `set` prefixes. e.g., `_age` -> `getAge`, `setAge`.
47+
--- - `getter`: Getter method name. Takes precedence over `convention`.
48+
--- - `setter`: Setter method name. Takes precedence over `convention`.
49+
---@attribute field_accessor(convention: "camelCase"|"PascalCase"|"snake_case"|nil, getter: string?, setter: string?)
50+
```
51+
52+
The syntax is `---@[attribute_name_1(arg...), attribute_name_2(arg...), ...]`, and multiple attributes can be used simultaneously. Example:
53+
```lua
54+
---@class A
55+
---@[deprecated] # If the attribute can omit parameters, `()` can be omitted
56+
---@field b string # b is now marked as deprecated
57+
---@[index_alias("b")]
58+
---@field [1] string # This will be shown as `b` in hints and completion
59+
```
60+
- **More Generic Type**: support generic like:
61+
```lua
62+
--- Get the parameters of a function as a tuple
63+
---@alias Parameters<T extends function> T extends (fun(...: infer P): any) and P or never
64+
65+
--- Get the parameters of a constructor as a tuple
66+
---@alias ConstructorParameters<T> T extends new (fun(...: infer P): any) and P or never
67+
68+
--- Make all properties in T optional
69+
---@alias Partial<T> { [P in keyof T]?: T[P]; }
70+
```
71+
72+
- **Support gutter request for intellij**: Added support for gutter requests in IntelliJ, allowing for better integration with the IDE's features.
73+
74+
### 🐛 Fixed
75+
- **Fix completion**: Fixed an issue where certain completions were not being suggested, like:
76+
```lua
77+
if not self:<|>
78+
```
79+
- **Fix '~' Replace error in config**: Fixed an issue where using '~' in configuration paths did not correctly expand to the user's home directory.
80+
- **Fix enum completion issue**: Fixed an issue where enum members were not being suggested in completions.
81+
- **Fix workspace load status bar**: Fixed an issue where the workspace load status bar always display in empty lua workspace.
82+
- **Fix some condition narrow**: Fixed some issues with condition-based type narrowing not working as expected.
83+
584

685
## [0.9.31] - 2025-10-17
786

CHANGELOG_CN.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,74 @@
11
# 🚀 Change Log
22

3+
## [0.9.32] - 2025-11-10
4+
### 🔧 变更
5+
- **重构 IndexAliasName**:移除原有的索引别名实现(`-- [IndexAliasName]`),现统一使用 `---@[index_alias("name")]`
6+
- **重构 ClassDefaultCall**:移除配置项 `runtime.class_default_call`,现统一使用 `---@[constructor("<constructor_method_name>")]`
7+
- **诊断项重命名**:将诊断项 `ParamTypeNotMatch` 重命名为 `ParamTypeMismatch`,更清晰易懂。
8+
- **优化注释解析逻辑**:注释现在会保留每行开头的空格,尽可能保持原有格式返回给 LSP 客户端。
9+
10+
### ✨ 新增
11+
- **Attribute 属性系统**:引入 `---@attribute` 新特性,用于定义额外元数据,内置若干属性:
12+
```lua
13+
--- 标记为已弃用,可选 message 参数。
14+
---@attribute deprecated(message: string?)
15+
16+
--- 语言服务器优化项。
17+
--- 参数:
18+
--- - `check_table_field`:跳过表字段赋值检查,适合大型配置表。
19+
--- - `delayed_definition`:变量类型由首次赋值决定,仅适用于无初始值的 `local` 声明。
20+
---@attribute lsp_optimization(code: "check_table_field"|"delayed_definition")
21+
22+
--- 索引字段别名,在 hint 和 completion 中显示别名。
23+
---@attribute index_alias(name: string)
24+
25+
--- 必须用于函数参数,且参数类型为字符串模板泛型。用于指定类的默认构造函数。
26+
--- 参数:
27+
--- - `name`:构造方法名
28+
--- - `root_class`:标记根类(如 C# 的 System.Object),默认空
29+
--- - `strip_self`:调用构造函数时是否可省略 self,默认 true
30+
--- - `return_self`:构造函数是否强制返回 self,默认 true
31+
---@attribute constructor(name: string, root_class: string?, strip_self: boolean?, return_self: boolean?)
32+
33+
--- 字段关联 getter/setter 方法,目前仅支持定义跳转,目标方法需在同一类中。
34+
--- 参数:
35+
--- - `convention`:命名规范,默认 camelCase,自动加 get/set 前缀
36+
--- - `getter`:getter 方法名,优先生效
37+
--- - `setter`:setter 方法名,优先生效
38+
---@attribute field_accessor(convention: "camelCase"|"PascalCase"|"snake_case"|nil, getter: string?, setter: string?)
39+
```
40+
语法为 `---@[attribute_name_1(arg...), attribute_name_2(arg...), ...]`,可同时使用多个属性。例如:
41+
```lua
42+
---@class A
43+
---@[deprecated] # 可省略参数时可省略 ()
44+
---@field b string # b 字段已标记为弃用
45+
---@[index_alias("b")]
46+
---@field [1] string # 在提示和补全中显示为 b
47+
```
48+
- **更丰富的泛型类型**:支持如下泛型写法:
49+
```lua
50+
--- 获取函数参数元组
51+
---@alias Parameters<T extends function> T extends (fun(...: infer P): any) and P or never
52+
53+
--- 获取构造函数参数元组
54+
---@alias ConstructorParameters<T> T extends new (fun(...: infer P): any) and P or never
55+
56+
--- 使 T 的所有属性可选
57+
---@alias Partial<T> { [P in keyof T]?: T[P]; }
58+
```
59+
- **支持 intellij 的 gutter 请求**:新增对 IntelliJ gutter 请求的支持,提升与 IDE 的集成体验。
60+
61+
### 🐛 修复
62+
- **补全修复**:修复某些情况下补全未能正确提示的问题,例如:
63+
```lua
64+
if not self:<|>
65+
```
66+
- **修复配置中 '~' 替换错误**:修复配置路径中使用 '~' 未能正确展开为用户主目录的问题。
67+
- **修复枚举补全问题**:修复枚举成员未能正确补全的问题。
68+
- **修复工作区加载状态栏**:修复空 Lua 工作区下状态栏一直显示加载的问题。
69+
- **修复条件收窄问题**:修复部分条件类型收窄未生效的问题。
70+
71+
372
## [0.9.31] - 2025-10-17
473

574
### ✨ 新增

build/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"emmyDebuggerVersion": "1.8.7",
33
"emmyDebuggerUrl": "https://github.com/EmmyLua/EmmyLuaDebugger/releases/download",
4-
"newLanguageServerVersion": "0.16.0",
4+
"newLanguageServerVersion": "0.17.0",
55
"newLanguageServerUrl": "https://github.com/CppCXY/emmylua-analyzer-rust/releases/download",
66
"newLanguageServerSchemaUrl": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/tags/{{tag}}/crates/emmylua_code_analysis/resources/schema.json"
77
}

build/schema-i18n.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,5 @@ export function main() {
166166
writeSchemaZhCn(translatedSchema);
167167
console.log(`已生成中文版 schema.zh-cn.json 文件`);
168168
}
169+
170+
main()

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "emmylua",
33
"displayName": "EmmyLua",
44
"description": "EmmyLua for vscode",
5-
"version": "0.9.31",
5+
"version": "0.9.32",
66
"icon": "res/icon.png",
77
"publisher": "tangzx",
88
"engines": {

syntaxes/schema.i18n.json

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
{
2-
"ClassDefaultCall.forceNonColon": {
3-
"en": "Mandatory non`:` definition. When `function_name` is not empty, it takes effect.",
4-
"zh-CN": "强制非冒号定义。当 `function_name` 不为空时生效。"
5-
},
6-
"ClassDefaultCall.forceReturnSelf": {
7-
"en": "Force to return `self`.",
8-
"zh-CN": "强制返回 `self`。"
9-
},
10-
"ClassDefaultCall.functionName": {
11-
"en": "class default overload function. eg. \"__init\".",
12-
"zh-CN": "类默认重载函数。例如:\"__init\""
13-
},
142
"DiagnosticCode.access-invisible": {
153
"en": "Access invisible",
164
"zh-CN": "成员可见性检查。"
@@ -23,6 +11,15 @@
2311
"en": "Assign type mismatch",
2412
"zh-CN": "赋值类型不匹配。"
2513
},
14+
"DiagnosticCode.attribute-missing-parameter": {
15+
"en": "attribute-missing-parameter"
16+
},
17+
"DiagnosticCode.attribute-param-type-mismatch": {
18+
"en": "attribute-param-type-mismatch"
19+
},
20+
"DiagnosticCode.attribute-redundant-parameter": {
21+
"en": "attribute-redundant-parameter"
22+
},
2623
"DiagnosticCode.await-in-sync": {
2724
"en": "Await in sync",
2825
"zh-CN": "在同步上下文中使用 await。"
@@ -78,6 +75,9 @@
7875
"en": "generic-constraint-mismatch",
7976
"zh-CN": "泛型约束不匹配。"
8077
},
78+
"DiagnosticCode.global-in-non-module": {
79+
"en": "Global variable defined in non-module scope"
80+
},
8181
"DiagnosticCode.incomplete-signature-doc": {
8282
"en": "Incomplete signature doc",
8383
"zh-CN": "不完整的签名文档。"
@@ -122,9 +122,14 @@
122122
"en": "non-literal-expressions-in-assert",
123123
"zh-CN": "在 assert 中使用了非字面量表达式。"
124124
},
125-
"DiagnosticCode.param-type-not-match": {
126-
"en": "Param Type not match",
127-
"zh-CN": "参数类型不匹配。"
125+
"DiagnosticCode.param-type-mismatch": {
126+
"en": "Param Type not match"
127+
},
128+
"DiagnosticCode.preferred-local-alias": {
129+
"en": "preferred-local-alias"
130+
},
131+
"DiagnosticCode.read-only": {
132+
"en": "readonly"
128133
},
129134
"DiagnosticCode.redefined-label": {
130135
"en": "Redefined label",
@@ -312,6 +317,9 @@
312317
"EmmyrcExternalTool.program": {
313318
"en": "The command to run the external tool."
314319
},
320+
"EmmyrcExternalTool.timeout": {
321+
"en": "The timeout for the external tool in milliseconds."
322+
},
315323
"EmmyrcFilenameConvention.camel-case": {
316324
"en": "Convert the filename to camelCase.",
317325
"zh-CN": "将文件名转换为驼峰(camelCase)命名。"
@@ -332,6 +340,9 @@
332340
"en": "Convert the filename to snake_case.",
333341
"zh-CN": "将文件名转换为蛇形(snake_case)命名。"
334342
},
343+
"EmmyrcHover.customDetail": {
344+
"en": "The detail number of hover information.\nDefault is `None`, which means using the default detail level.\nYou can set it to a number between `1` and `255` to customize"
345+
},
335346
"EmmyrcHover.enable": {
336347
"en": "Enable showing documentation on hover.",
337348
"zh-CN": "是否启用悬浮提示。"
@@ -402,15 +413,14 @@
402413
"zh-CN": "缓存短字符串用于搜索。"
403414
},
404415
"EmmyrcReformat.externalTool": {
405-
"en": "Whether to enable internal code reformatting."
416+
"en": "Whether to enable external tool formatting."
417+
},
418+
"EmmyrcReformat.externalToolRangeFormat": {
419+
"en": "Whether to enable external tool range formatting."
406420
},
407421
"EmmyrcReformat.useDiff": {
408422
"en": "Whether to use the diff algorithm for formatting."
409423
},
410-
"EmmyrcRuntime.classDefaultCall": {
411-
"en": "class default overload function.",
412-
"zh-CN": "类默认重载函数。"
413-
},
414424
"EmmyrcRuntime.extensions": {
415425
"en": "file Extensions. eg: .lua, .lua.txt",
416426
"zh-CN": "文件扩展名。例如:.lua, .lua.txt"
@@ -430,6 +440,9 @@
430440
"en": "Require pattern. eg. \"?.lua\", \"?/init.lua\"",
431441
"zh-CN": "require 模式。例如:\"?.lua\", \"?/init.lua\""
432442
},
443+
"EmmyrcRuntime.special": {
444+
"en": "Special symbols."
445+
},
433446
"EmmyrcRuntime.version": {
434447
"en": "Lua version.",
435448
"zh-CN": "Lua 版本。"

syntaxes/schema.json

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@
110110
"runtime": {
111111
"$ref": "#/$defs/EmmyrcRuntime",
112112
"default": {
113-
"classDefaultCall": {
114-
"forceNonColon": false,
115-
"forceReturnSelf": false,
116-
"functionName": ""
117-
},
118113
"extensions": [],
119114
"frameworkVersions": [],
120115
"nonstandardSymbol": [],
@@ -163,26 +158,6 @@
163158
}
164159
},
165160
"$defs": {
166-
"ClassDefaultCall": {
167-
"type": "object",
168-
"properties": {
169-
"forceNonColon": {
170-
"description": "Mandatory non`:` definition. When `function_name` is not empty, it takes effect.",
171-
"type": "boolean",
172-
"default": true
173-
},
174-
"forceReturnSelf": {
175-
"description": "Force to return `self`.",
176-
"type": "boolean",
177-
"default": true
178-
},
179-
"functionName": {
180-
"description": "class default overload function. eg. \"__init\".",
181-
"type": "string",
182-
"default": ""
183-
}
184-
}
185-
},
186161
"DiagnosticCode": {
187162
"oneOf": [
188163
{
@@ -214,7 +189,7 @@
214189
{
215190
"description": "Param Type not match",
216191
"type": "string",
217-
"const": "param-type-not-match"
192+
"const": "param-type-mismatch"
218193
},
219194
{
220195
"description": "Missing parameter",
@@ -435,6 +410,21 @@
435410
"description": "Global variable defined in non-module scope",
436411
"type": "string",
437412
"const": "global-in-non-module"
413+
},
414+
{
415+
"description": "attribute-param-type-mismatch",
416+
"type": "string",
417+
"const": "attribute-param-type-mismatch"
418+
},
419+
{
420+
"description": "attribute-missing-parameter",
421+
"type": "string",
422+
"const": "attribute-missing-parameter"
423+
},
424+
{
425+
"description": "attribute-redundant-parameter",
426+
"type": "string",
427+
"const": "attribute-redundant-parameter"
438428
}
439429
]
440430
},
@@ -942,15 +932,6 @@
942932
"EmmyrcRuntime": {
943933
"type": "object",
944934
"properties": {
945-
"classDefaultCall": {
946-
"description": "class default overload function.",
947-
"$ref": "#/$defs/ClassDefaultCall",
948-
"default": {
949-
"forceNonColon": false,
950-
"forceReturnSelf": false,
951-
"functionName": ""
952-
}
953-
},
954935
"extensions": {
955936
"description": "file Extensions. eg: .lua, .lua.txt",
956937
"type": "array",
@@ -1158,4 +1139,4 @@
11581139
]
11591140
}
11601141
}
1161-
}
1142+
}

0 commit comments

Comments
 (0)