Skip to content

Commit 31e61ec

Browse files
committed
update
1 parent 54e908b commit 31e61ec

File tree

6 files changed

+92
-3
lines changed

6 files changed

+92
-3
lines changed

CHANGELOG.md

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

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

5+
## [0.9.33] - 2025-12-8
6+
7+
An experimental Lua 5.4 interpreter implemented in Rust: https://github.com/CppCXY/lua-rs
8+
9+
### ✨ Added
10+
11+
- **Type narrowing with union types using field checks**: Changed the behavior when using a field of a union type in an `if` statement for type narrowing. Now, if the field exists in some types of the union but not in others, the types without that field will be excluded from the narrowed type. For example:
12+
```lua
13+
local a --- @type string|{foo:boolean, bar:string}
14+
15+
if a.foo then
16+
local _ = a.bar -- a will be narrowed to {foo:boolean, bar:string}
17+
end
18+
```
19+
- **Support generic in @field**: You can now use declaration generic type in `@field` annotations. For example:
20+
```lua
21+
---@class GetType
22+
---@field get_type fun<T>(name:`T`): T
23+
local MyClass = {}
24+
25+
local d = MyClass.get_type("Car") -- d: "Car"
26+
```
27+
28+
### 🔧 Changed
29+
30+
- **Refactor Document Symbols**: Refactored the `textDocument/documentSymbol` request to improve performance and accuracy. The new implementation provides better handling of nested symbols and improves the overall structure of the returned symbol tree.
31+
32+
33+
### 🐛 Fixed
34+
- **Fix Lazyvim.dev integration issue**: Fixed an issue where Lazyvim.dev integration did not work correctly due to ignore `workspace/didConfiguration` changes.
35+
- **Fix Completion**: Fixed an issue where certain completions were not being suggested, like:
36+
`Partial<Type>`
37+
- **Fix nil propagation in consecutive field access**: Fixed an issue where, during consecutive field access, if a previous field could be nil, subsequent fields would incorrectly propagate the nil type. For example:
38+
```lua
39+
local a --- @type { foo? : { bar: { baz: number } } }
40+
41+
local b = a.foo.bar -- a.foo may be nil (correct)
42+
43+
local _ = b.baz -- b is number
44+
```
45+
46+
547
## [0.9.32] - 2025-11-10
648
### 🔧 Changed
749
- **Refactor IndexAliasName**: Removed the original index alias implementation (`-- [IndexAliasName]`), now use `---@[index_alias("name")]`.

CHANGELOG_CN.md

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

3+
## [0.9.33] - 2025-12-8
4+
5+
一个实验性的Lua解释器项目: https://github.com/CppCXY/lua-rs
6+
7+
### ✨ Added
8+
- **联合类型字段检查收窄类型**:变更了在 `if` 语句中通过联合类型字段进行类型收窄的行为。现在,如果某字段只存在于联合类型的部分类型中,则收窄后会排除没有该字段的类型。例如:
9+
```lua
10+
local a --- @type string|{foo:boolean, bar:string}
11+
12+
if a.foo then
13+
local _ = a.bar -- 此时 a 被收窄为 {foo:boolean, bar:string}
14+
end
15+
```
16+
- **@field 支持泛型类型**:现在可以在 `@field` 注解中使用声明泛型类型。例如:
17+
```lua
18+
---@class GetType
19+
---@field get_type fun<T>(name:`T`): T
20+
local MyClass = {}
21+
22+
local d = MyClass.get_type("Car") -- d: "Car"
23+
```
24+
25+
### 🔧 变更
26+
27+
- **重构文档符号**:重构了 `textDocument/documentSymbol` 请求,提升了性能和准确性。新实现更好地处理嵌套符号,并优化了返回的符号树结构。
28+
29+
### 🐛 修复
30+
- **修复 Lazyvim.dev 集成问题**:修复了因忽略 `workspace/didConfiguration` 变更导致 Lazyvim.dev 集成失效的问题。
31+
- **修复补全问题**:修复了某些补全项未能正确提示的问题,例如:
32+
`Partial<Type>`
33+
- **修复连续字段访问时 nil 传播问题**:修复了连续字段访问时,前一个字段可能为 nil 导致后续字段错误传播 nil 类型的问题。例如:
34+
```lua
35+
local a --- @type { foo? : { bar: { baz: number } } }
36+
37+
local b = a.foo.bar -- a.foo 可能为 nil(正确)
38+
39+
local _ = b.baz -- b 是 number
40+
```
41+
342
## [0.9.32] - 2025-11-10
443
### 🔧 变更
544
- **重构 IndexAliasName**:移除原有的索引别名实现(`-- [IndexAliasName]`),现统一使用 `---@[index_alias("name")]`

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.17.0",
4+
"newLanguageServerVersion": "0.18.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
}

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.32",
5+
"version": "0.9.33",
66
"icon": "res/icon.png",
77
"publisher": "tangzx",
88
"engines": {

src/configRenames.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as vscode from 'vscode';
55
* Maps new keys to old keys for backward compatibility
66
*/
77
const CONFIG_RENAMES: ReadonlyMap<string, string> = new Map([
8-
['emmylua.colors.mutableUnderline', 'emmylua.colors.mutable_underline'],
98
['emmylua.ls.executablePath', 'emmylua.misc.executablePath'],
109
['emmylua.ls.globalConfigPath', 'emmylua.misc.globalConfigPath'],
1110
['emmylua.language.completeAnnotation', 'emmylua.misc.autoInsertTripleDash'],

syntaxes/schema.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"ignoreGlobs": [],
152152
"library": [],
153153
"moduleMap": [],
154+
"packageDirs": [],
154155
"preloadFileSize": 0,
155156
"reindexDuration": 5000,
156157
"workspaceRoots": []
@@ -1100,6 +1101,14 @@
11001101
"$ref": "#/$defs/EmmyrcWorkspaceModuleMap"
11011102
}
11021103
},
1104+
"packageDirs": {
1105+
"description": "Package directories. Treat the parent directory as a `library`, but only add files from the specified directory.\neg: `/usr/local/share/lua/5.1/module`",
1106+
"type": "array",
1107+
"default": [],
1108+
"items": {
1109+
"type": "string"
1110+
}
1111+
},
11031112
"preloadFileSize": {
11041113
"type": "integer",
11051114
"format": "int32",

0 commit comments

Comments
 (0)