|
4 | 4 |
|
5 | 5 | --- |
6 | 6 | ## [0.17.0] - Unreleased |
7 | | - |
8 | 7 | ### 🔧 Changed |
9 | | -- **Refactor IndexAliasName**: 删除原先的索引别名实现(`-- [IndexAliasName]`), 现在使用`---@[index_alias("name")]` |
10 | | -- **Refactor ClassDefaultCall**: 删除配置项`runtime.class_default_call`, 转为使用`---@[constructor("<constructor_method_name>")]` |
| 8 | +- **Refactor IndexAliasName**: Removed the original index alias implementation (`-- [IndexAliasName]`), now use `---@[index_alias("name")]`. |
| 9 | +- **Refactor ClassDefaultCall**: Removed the configuration item `runtime.class_default_call`, now use `---@[constructor("<constructor_method_name>")]`. |
| 10 | +- **Rename ParamTypeNotMatch to ParamTypeMismatch**: Renamed the diagnostic `ParamTypeNotMatch` to `ParamTypeMismatch` for better clarity. |
| 11 | +- **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. |
| 12 | + |
11 | 13 |
|
12 | 14 | ### ✨ Added |
13 | | -- **Attribute**: 实现了新的特性`---@attribute`,用于定义附加元数据,内置多个特性: |
| 15 | +- **Attribute**: Introduced the new feature `---@attribute` for defining additional metadata, with several built-in attributes: |
14 | 16 | ```lua |
15 | | - |
16 | | ---- Deprecated. Receives an optional message parameter. |
| 17 | +--- Deprecated. Accepts an optional message parameter. |
17 | 18 | ---@attribute deprecated(message: string?) |
18 | 19 |
|
19 | 20 | --- Language Server Optimization Items. |
20 | 21 | --- |
21 | 22 | --- Parameters: |
22 | | ---- - `check_table_field`: Skip the assign check for table fields. It is recommended to use this option for all large configuration tables. |
23 | | ---- - `delayed_definition`: Indicates that the type of the variable is determined by the first assignment. |
24 | | ---- Only valid for `local` declarations with no initial value. |
| 23 | +--- - `check_table_field`: Skips assignment checks for table fields. Recommended for large configuration tables. |
| 24 | +--- - `delayed_definition`: Indicates the variable type is determined by the first assignment. |
| 25 | +--- Only valid for `local` declarations without an initial value. |
25 | 26 | ---@attribute lsp_optimization(code: "check_table_field"|"delayed_definition") |
26 | 27 |
|
27 | | ---- Index field alias, will be displayed in `hint` and `completion`. |
| 28 | +--- Index field alias, displayed in `hint` and `completion`. |
28 | 29 | --- |
29 | | ---- Receives a string parameter for the alias name. |
| 30 | +--- Accepts a string parameter for the alias name. |
30 | 31 | ---@attribute index_alias(name: string) |
31 | 32 |
|
32 | | ---- This attribute must be applied to function parameters, and the function parameter's type must be a string template generic, |
33 | | ---- used to specify the default constructor of a class. |
| 33 | +--- This attribute must be applied to function parameters, and the parameter type must be a string template generic. |
| 34 | +--- Used to specify the default constructor of a class. |
34 | 35 | --- |
35 | 36 | --- Parameters: |
36 | | ---- - `name`: The name of the method as a constructor. |
37 | | ---- - `root_class`: Used to mark the root class, will implicitly inherit this class, such as `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` |
| 37 | +--- - `name`: The method name as a constructor. |
| 38 | +--- - `root_class`: Marks the root class, will be implicitly inherited, e.g., `System.Object` in C#. Defaults to empty. |
| 39 | +--- - `strip_self`: Whether the `self` parameter can be omitted when calling the constructor, defaults to `true`. |
| 40 | +--- - `return_self`: Whether the constructor is forced to return `self`, defaults to `true`. |
40 | 41 | ---@attribute constructor(name: string, root_class: string?, strip_self: boolean?, return_self: boolean?) |
41 | 42 |
|
42 | | ---- Associates `getter` and `setter` methods with a field. Currently provides only definition navigation functionality, |
43 | | ---- and the target methods must reside within the same class. |
| 43 | +--- Associates `getter` and `setter` methods with a field. Currently only provides definition navigation functionality. |
| 44 | +--- The target methods must be within the same class. |
44 | 45 | --- |
45 | 46 | --- Parameters: |
46 | | ---- - `convention`: Naming convention, defaults to `camelCase`. Implicitly adds `get` and `set` prefixes. eg: `_age` -> `getAge`, `setAge`. |
| 47 | +--- - `convention`: Naming convention, defaults to `camelCase`. Implicitly adds `get` and `set` prefixes. e.g., `_age` -> `getAge`, `setAge`. |
47 | 48 | --- - `getter`: Getter method name. Takes precedence over `convention`. |
48 | 49 | --- - `setter`: Setter method name. Takes precedence over `convention`. |
49 | 50 | ---@attribute field_accessor(convention: "camelCase"|"PascalCase"|"snake_case"|nil, getter: string?, setter: string?) |
50 | 51 | ``` |
51 | 52 |
|
52 | | -使用语法为 `---@[attribute_name_1(arg...), attribute_name_2(arg...), ...]`, 可以同时使用多个特性, 示例: |
| 53 | +The syntax is `---@[attribute_name_1(arg...), attribute_name_2(arg...), ...]`, and multiple attributes can be used simultaneously. Example: |
53 | 54 | ```lua |
54 | 55 | ---@class A |
55 | | ----@[deprecated] # 如果特性可以省略参数, 则可以省略`()` |
56 | | ----@field b string # b 此时被标记为弃用 |
| 56 | +---@[deprecated] # If the attribute can omit parameters, `()` can be omitted |
| 57 | +---@field b string # b is now marked as deprecated |
57 | 58 | ---@[index_alias("b")] |
58 | | ----@field [1] string # 此时在提示和补全中会显示为 `b` |
| 59 | +---@field [1] string # This will be shown as `b` in hints and completion |
| 60 | +``` |
| 61 | +- **More Generic Type**: support generic like: |
| 62 | +```lua |
| 63 | +--- Get the parameters of a function as a tuple |
| 64 | +---@alias Parameters<T extends function> T extends (fun(...: infer P): any) and P or never |
| 65 | + |
| 66 | +--- Get the parameters of a constructor as a tuple |
| 67 | +---@alias ConstructorParameters<T> T extends new (fun(...: infer P): any) and P or never |
| 68 | + |
| 69 | +--- Make all properties in T optional |
| 70 | +---@alias Partial<T> { [P in keyof T]?: T[P]; } |
59 | 71 | ``` |
60 | 72 |
|
| 73 | +- **Support gutter request for intellij**: Added support for gutter requests in IntelliJ, allowing for better integration with the IDE's features. |
| 74 | + |
| 75 | +### 🐛 Fixed |
| 76 | +- **Fix completion**: Fixed an issue where certain completions were not being suggested, like: |
| 77 | +```lua |
| 78 | +if not self:<|> |
| 79 | +``` |
| 80 | +- **Fix '~' Replace error in config**: Fixed an issue where using '~' in configuration paths did not correctly expand to the user's home directory. |
| 81 | +- **Fix enum completion issue**: Fixed an issue where enum members were not being suggested in completions. |
| 82 | +- **Fix workspace load status bar**: Fixed an issue where the workspace load status bar always display in empty lua workspace. |
| 83 | +- **Fix some condition narrow**: Fixed some issues with condition-based type narrowing not working as expected. |
| 84 | + |
| 85 | + |
61 | 86 | ## [0.16.0] - 2025-10-17 |
62 | 87 | ### ✨ Added |
63 | 88 | - **Support `workspace/diagnostic`**: Added support for the `workspace/diagnostic` request, allowing clients to fetch diagnostics for the entire workspace. |
|
0 commit comments