Skip to content

Commit e3cfd38

Browse files
committed
update
1 parent 8b2e390 commit e3cfd38

5 files changed

Lines changed: 134 additions & 32 deletions

File tree

CHANGELOG.md

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

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

5+
## [0.9.34] - 2025-12-29
6+
7+
### ✨ Added
8+
- **Support Lua5.5**: Added support for Lua 5.5 syntax and features, including global declarations, table.create, and named vararg. For example:
9+
```lua
10+
global *
11+
global <const> a, b, c
12+
global d, e, f = 1, 2, 3
13+
table.create(10, 0)
14+
function func(...args)
15+
end
16+
```
17+
18+
- **Support format Lua 5.5 syntax**: The built-in formatter now supports formatting Lua 5.5 syntax.
19+
- **Add new stdlib i18n translation**: Added new internationalization functions to the standard library.
20+
- **Support call argument snippet completion**: When `"completion.callSnippet": true` is enabled, provide snippet completions for function arguments during function calls.
21+
- **Support param/@return completion**: Typing `---@` above a function will show `param/@return` completion suggestions; accepting a suggestion will automatically fill parameter names and types.
22+
23+
### 🔧 Changed
24+
25+
- **Workspace variable search optimization**: Optimized workspace-wide variable search to decide whether to use case-sensitive or case-insensitive matching based on the input's casing.
26+
27+
### 🐛 Fixed
28+
29+
- **Fix integer literal parsing issue**: Integers exceeding int64 are now recognized as floats instead of being treated as 0.
30+
- **Fix typecheck**: Fixed several type checking issues.
31+
532
## [0.9.33] - 2025-12-8
633

734
An experimental Lua 5.4 interpreter implemented in Rust: https://github.com/CppCXY/lua-rs

CHANGELOG_CN.md

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

3+
## [0.9.34] - 2025-12-29
4+
5+
### ✨ 新增
6+
7+
- **支持 Lua 5.5**:新增对 Lua 5.5 语法和特性的支持,包括全局声明、table.create 及命名 vararg。例如:
8+
```lua
9+
global *
10+
global <const> a, b, c
11+
global d, e, f = 1, 2, 3
12+
table.create(10, 0)
13+
function func(...args)
14+
end
15+
```
16+
17+
- **支持格式化 Lua 5.5 语法**:内置格式化器现在支持格式化 Lua 5.5 语法。
18+
- **新增标准库 i18n 翻译**:为标准库新增国际化函数。
19+
- **支持调用参数片段补全**:当 "completion.callSnippet": true 启用时,在函数调用处提供参数片段补全。
20+
- **支持 param/@return 补全**:在函数上方输入 `---@` 时会显示 `param/@return` 补全建议;接受建议会自动填充参数名和类型。
21+
22+
### 🔧 变更
23+
24+
- **工作区变量搜索优化**:优化了工作区范围的变量搜索,会根据输入的大小写决定使用区分大小写还是不区分大小写的匹配。
25+
26+
### 🐛 修复
27+
28+
- **修复整数字面量解析问题**:超过 int64 的整数现在会被识别为浮点数,而不是被当作 0。
29+
- **修复类型检查**:修复了若干类型检查相关的问题。
30+
331
## [0.9.33] - 2025-12-8
432

533
一个实验性的Lua解释器项目: https://github.com/CppCXY/lua-rs

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

src/configManager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as vscode from 'vscode';
44
/**
55
* 获取配置值, 且支持重命名的键名.
66
*
7-
* 会自动回退至旧配置键名, 确保向后兼容性.
87
*
98
* @param config - 配置
109
* @param key - 必须传入最新的配置键名以正确获取配置值

src/luaTerminalLinkProvider.ts

Lines changed: 78 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -99,43 +99,91 @@ class LuaTerminalLinkProvider implements vscode.TerminalLinkProvider {
9999
_token: vscode.CancellationToken
100100
): vscode.ProviderResult<LuaTerminalLink[]> {
101101
const line = context.line;
102+
103+
// 快速预检查:行中是否包含 .lua 文件引用
104+
// 这比正则匹配快得多
105+
if (!line.includes('.lua')) {
106+
return [];
107+
}
108+
109+
// 进一步检查:是否包含行号标记(冒号+数字)
110+
// 大多数 Lua 错误都有行号
111+
const hasLineNumber = /\.lua:\d+/.test(line);
112+
102113
const allMatches: Array<{
103114
link: LuaTerminalLink;
104115
priority: number;
105116
}> = [];
106117

107-
// 尝试所有模式
108-
for (const pattern of this.patterns) {
109-
pattern.regex.lastIndex = 0;
110-
111-
let match: RegExpExecArray | null;
112-
while ((match = pattern.regex.exec(line)) !== null) {
113-
const fullMatch = match[0];
114-
const filePath = match[1];
115-
const lineNumber = match[2] ? parseInt(match[2], 10) : undefined;
116-
const columnNumber = match[3] ? parseInt(match[3], 10) : undefined;
117-
118-
// 验证文件路径的合理性
119-
if (!this.isValidLuaPath(filePath, line, match.index)) {
120-
continue;
121-
}
118+
// 根据是否有行号选择不同的匹配策略
119+
if (hasLineNumber) {
120+
// 优先匹配带行号的模式(更精确,性能更好)
121+
for (let i = 0; i < this.patterns.length - 1; i++) {
122+
const pattern = this.patterns[i];
123+
pattern.regex.lastIndex = 0;
124+
125+
let match: RegExpExecArray | null;
126+
while ((match = pattern.regex.exec(line)) !== null) {
127+
const fullMatch = match[0];
128+
const filePath = match[1];
129+
const lineNumber = match[2] ? parseInt(match[2], 10) : undefined;
130+
const columnNumber = match[3] ? parseInt(match[3], 10) : undefined;
131+
132+
// 验证文件路径的合理性
133+
if (!this.isValidLuaPath(filePath, line, match.index)) {
134+
continue;
135+
}
122136

123-
// 创建链接
124-
const tooltip = this.createTooltip(filePath, lineNumber, columnNumber);
125-
const link = new LuaTerminalLink(
126-
match.index,
127-
fullMatch.length,
128-
tooltip,
129-
filePath,
130-
lineNumber,
131-
columnNumber,
132-
fullMatch
133-
);
137+
// 创建链接
138+
const tooltip = this.createTooltip(filePath, lineNumber, columnNumber);
139+
const link = new LuaTerminalLink(
140+
match.index,
141+
fullMatch.length,
142+
tooltip,
143+
filePath,
144+
lineNumber,
145+
columnNumber,
146+
fullMatch
147+
);
148+
149+
allMatches.push({
150+
link,
151+
priority: pattern.priority
152+
});
153+
}
154+
}
155+
} else {
156+
// 如果没有行号,尝试所有模式(但这种情况很少)
157+
for (const pattern of this.patterns) {
158+
pattern.regex.lastIndex = 0;
159+
160+
let match: RegExpExecArray | null;
161+
while ((match = pattern.regex.exec(line)) !== null) {
162+
const fullMatch = match[0];
163+
const filePath = match[1];
164+
const lineNumber = match[2] ? parseInt(match[2], 10) : undefined;
165+
const columnNumber = match[3] ? parseInt(match[3], 10) : undefined;
166+
167+
if (!this.isValidLuaPath(filePath, line, match.index)) {
168+
continue;
169+
}
134170

135-
allMatches.push({
136-
link,
137-
priority: pattern.priority
138-
});
171+
const tooltip = this.createTooltip(filePath, lineNumber, columnNumber);
172+
const link = new LuaTerminalLink(
173+
match.index,
174+
fullMatch.length,
175+
tooltip,
176+
filePath,
177+
lineNumber,
178+
columnNumber,
179+
fullMatch
180+
);
181+
182+
allMatches.push({
183+
link,
184+
priority: pattern.priority
185+
});
186+
}
139187
}
140188
}
141189

0 commit comments

Comments
 (0)