Skip to content

Commit

Permalink
0.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Apr 10, 2024
1 parent 11d90cb commit 6ebfbd7
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 26 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,17 @@

[English Change Log](CHANGELOG_EN.md)

# 0.6.6

`FIX` 修复一些补全问题

`NEW` 增加一个显示解析进度的条

`NEW` 替换插件端的debug inline values特性, 改为语言服务实现

`NEW` 实现函数环境下self字段的直接补全而不用写self


# 0.6.5

`FIX` 修复部分全局变量没有标记为红色的BUG
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG_EN.md
@@ -1,5 +1,15 @@
# Change Log

# 0.6.6

`FIX` Fixed some completion issues

`NEW` Added a progress bar for parsing

`NEW` Replaced the debug inline values feature on the plugin side with language service implementation

`NEW` Implemented direct completion of the `self` field in function context without having to write `self`

# 0.6.5

`FIX` Fixed the bug where some global variables were not marked in red
Expand Down
2 changes: 1 addition & 1 deletion build/config.js
Expand Up @@ -3,6 +3,6 @@ exports.default = {
emmyDebuggerUrl: 'https://github.com/EmmyLua/EmmyLuaDebugger/releases/download',
lanServerVersion: "0.5.16",
lanServerUrl: 'https://github.com/EmmyLua/EmmyLua-LanguageServer/releases/download',
newLanguageServerVersion: "0.1.4",
newLanguageServerVersion: "0.1.5",
newLanguageServerUrl: "https://github.com/CppCXY/EmmyLuaAnalyzer/releases/download"
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -2,7 +2,7 @@
"name": "emmylua",
"displayName": "EmmyLua",
"description": "EmmyLua for vscode",
"version": "0.6.5",
"version": "0.6.6",
"icon": "res/icon.png",
"publisher": "tangzx",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/emmyContext.ts
Expand Up @@ -72,7 +72,7 @@ export class EmmyContext {
registerProtocol() {
this.client?.onNotification("emmy/progressReport", (d: IProgressReport) => {
this.loadBar.show();
this.loadBar.text = `${d.text}`;
this.loadBar.text = `$(sync~spin) ${d.text}`;
if (d.percent >= 1) {
setTimeout(() => {
this.loadBar.hide();
Expand Down
48 changes: 25 additions & 23 deletions src/extension.ts
Expand Up @@ -76,36 +76,38 @@ function registerDebuggers() {
context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('emmylua_attach', factory));
context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('emmylua_launch', factory));
}
context.subscriptions.push(vscode.languages.registerInlineValuesProvider('lua', {
// 不知道是否应该发到ls上再做处理
// 先简单处理一下吧
provideInlineValues(document: vscode.TextDocument, viewport: vscode.Range, context: vscode.InlineValueContext): vscode.ProviderResult<vscode.InlineValue[]> {
if (!ctx.newLanguageServer) {
context.subscriptions.push(vscode.languages.registerInlineValuesProvider('lua', {
// 不知道是否应该发到ls上再做处理
// 先简单处理一下吧
provideInlineValues(document: vscode.TextDocument, viewport: vscode.Range, context: vscode.InlineValueContext): vscode.ProviderResult<vscode.InlineValue[]> {

const allValues: vscode.InlineValue[] = [];
const regExps = [
/(?<=local\s+)[^\s,\<]+/,
/(?<=---@param\s+)\S+/
]
const allValues: vscode.InlineValue[] = [];
const regExps = [
/(?<=local\s+)[^\s,\<]+/,
/(?<=---@param\s+)\S+/
]

for (let l = viewport.start.line; l <= context.stoppedLocation.end.line; l++) {
const line = document.lineAt(l);
for (let l = viewport.start.line; l <= context.stoppedLocation.end.line; l++) {
const line = document.lineAt(l);

for (const regExp of regExps) {
const match = regExp.exec(line.text);
if (match) {
const varName = match[0];
const varRange = new vscode.Range(l, match.index, l, match.index + varName.length);
// value found via variable lookup
allValues.push(new vscode.InlineValueVariableLookup(varRange, varName, false));
break;
for (const regExp of regExps) {
const match = regExp.exec(line.text);
if (match) {
const varName = match[0];
const varRange = new vscode.Range(l, match.index, l, match.index + varName.length);
// value found via variable lookup
allValues.push(new vscode.InlineValueVariableLookup(varRange, varName, false));
break;
}
}

}

return allValues;
}

return allValues;
}
}));
}));
}
}

function onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) {
Expand Down

0 comments on commit 6ebfbd7

Please sign in to comment.