Skip to content

Commit

Permalink
update 0.5.14
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed May 22, 2023
1 parent ae21d15 commit 0886690
Show file tree
Hide file tree
Showing 12 changed files with 203 additions and 83 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@

## next

1. 全新的语言服务正在开发中.
全新的语言服务正在开发中, 项目使用rust重写.

## 0.5.14

`FIX` 修复调试问题, 调试器升级到1.5.1

`FIX` 修复代码补全时因为alias导致的递归爆栈

`NEW` 加个显示emmylua运行状态的item bar

`CHANGE` 移除找不到java时右下角的显示

`CHANGE` 允许停用emmylua语言服务

## 0.5.13

Expand Down
18 changes: 17 additions & 1 deletion CHANGELOG_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@

## next

1. A new language server is under development
A completely new language service is under development, and the project is rewritten using Rust.

## 0.5.14

`FIX` fixes debugging issues and upgrades the debugger to 1.5.1

`FIX` fixes the recursive explosion stack caused by alias when code completion

`NEW` adds an item bar that shows the running status of emmylua

`CHANGE` removes the display in the lower right corner when Java is not found

`CHANGE` allows deactivation of the emmylua language service

## 0.5.13

`FIX` fixes an issue where when using emmylua-unity, the unity class cannot be hinted after inheriting

## 0.5.12

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ A: 在项目根目录创建`emmy.config.json`然后如下填写:
```
Q: 全新的语言服务何时上线?

A: 不知道, 但是你可以访问[这里](https://github.com/CppCXY/EmmyLua-LanguageServer2)关注一下进度
A: 不知道
4 changes: 2 additions & 2 deletions build/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports.default = {
emmyDebuggerVersion: '1.5.0',
emmyDebuggerVersion: '1.5.1',
emmyDebuggerUrl: 'https://github.com/EmmyLua/EmmyLuaDebugger/releases/download',
lanServerVersion: "0.5.13",
lanServerVersion: "0.5.14",
lanServerUrl: 'https://github.com/EmmyLua/EmmyLua-LanguageServer/releases/download'
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "emmylua",
"displayName": "EmmyLua",
"description": "EmmyLua for vscode",
"version": "0.5.13",
"version": "0.5.14",
"icon": "res/icon.png",
"publisher": "tangzx",
"engines": {
Expand Down Expand Up @@ -38,6 +38,10 @@
{
"command": "emmlua.syntax.view",
"title": "EmmyLua: View Syntax Tree"
},
{
"command": "emmlua.stopServer",
"title": "EmmyLua: Stop EmmyLua Language Server"
}
],
"snippets": [
Expand Down Expand Up @@ -482,4 +486,4 @@
"vscode-debugprotocol": "1.51.0",
"vscode-languageclient": "8.0.2"
}
}
}
4 changes: 2 additions & 2 deletions src/annotator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import * as vscode from 'vscode';
import { AnnotatorType } from './notifications';
import { AnnotatorType } from './lspExt';
import { LanguageClient } from 'vscode-languageclient/node';
import * as notifications from "./notifications";
import * as notifications from "./lspExt";


let D_PARAM: vscode.TextEditorDecorationType;
Expand Down
4 changes: 2 additions & 2 deletions src/debugger/EmmyDebuggerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import * as vscode from 'vscode';
import { EmmyDebugConfiguration } from './types';
import { luaContext } from '../extension';
import { ctx } from '../extension';
import { DebuggerProvider } from './DebuggerProvider';

export class EmmyDebuggerProvider extends DebuggerProvider {
private showWaitConnectionToken = new vscode.CancellationTokenSource();

resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, debugConfiguration: EmmyDebugConfiguration, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
debugConfiguration.extensionPath = luaContext.extensionContext.extensionPath;
debugConfiguration.extensionPath = ctx.extensionContext.extensionPath;
debugConfiguration.sourcePaths = this.getSourceRoots();
if (!debugConfiguration.request) {
debugConfiguration.request = "launch";
Expand Down
100 changes: 100 additions & 0 deletions src/emmyCtx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import * as vscode from 'vscode';
import { LanguageClient } from 'vscode-languageclient/node';
import { IProgressReport, ServerStatusParams } from './lspExt';

export class EmmyCtx {
public LANGUAGE_ID: string = "lua"; //EmmyLua
public client?: LanguageClient;
private readonly statusBar: vscode.StatusBarItem;
private loadBar: vscode.StatusBarItem;

constructor(
public debugMode: boolean,
public extensionContext: vscode.ExtensionContext,

) {
this.statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
this.loadBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
this.setServerStatus({
health: "ok"
})
}

setServerStatus(status: ServerStatusParams) {
let icon = "";
const statusBar = this.statusBar;
statusBar.show();
statusBar.tooltip = new vscode.MarkdownString("", true);
statusBar.tooltip.isTrusted = true;
switch (status.health) {
case "ok":
statusBar.tooltip.appendText(status.message ?? "");
statusBar.tooltip.appendMarkdown("\n\n[Stop EmmyLua](command:emmy.stopServer)");
statusBar.color = undefined;
statusBar.backgroundColor = undefined;
status.command = "emmy.stopServer"
break;
case "warning":
if (status.message) {
statusBar.tooltip.appendText(status.message);
}
statusBar.color = new vscode.ThemeColor("statusBarItem.warningForeground");
statusBar.backgroundColor = new vscode.ThemeColor(
"statusBarItem.warningBackground"
)
icon = "$(warning) ";
break;
case "error":
if (status.message) {
statusBar.tooltip.appendText(status.message);
}
statusBar.color = new vscode.ThemeColor("statusBarItem.errorForeground");
statusBar.backgroundColor = new vscode.ThemeColor("statusBarItem.errorBackground");
icon = "$(error) ";
break;
case "stop":
statusBar.tooltip.appendText("EmmyLua is stopped");
statusBar.tooltip.appendMarkdown("\n\n[Restart EmmyLua](command:emmy.restartServer)");
statusBar.color = undefined;
statusBar.backgroundColor = undefined;
status.command = "emmy.restartServer"
icon = "$(stop-circle) "
break;
}
if (statusBar.tooltip.value) {
statusBar.tooltip.appendText("\n\n");
}
statusBar.command = status.command;
if (status.loading) icon = "$(sync~spin) ";
statusBar.text = `${icon}EmmyLua`;
}

registerProtocol() {
this.client?.onNotification("emmy/progressReport", (d: IProgressReport) => {
this.loadBar.show();
this.loadBar.text = `${d.text}`;
if (d.percent >= 1) {
setTimeout(() => {
this.loadBar.hide();
}, 1000);
}
});

this.client?.onNotification("emmy/setServerStatus", (param: ServerStatusParams) => {
this.setServerStatus(param);
});
}

stopServer() {
this.client?.stop();
this.setServerStatus({
health: "stop"
});
}

dispose() {
this.client?.stop();
this.statusBar.dispose();
this.loadBar.dispose();
}
}
Loading

0 comments on commit 0886690

Please sign in to comment.