Skip to content

Commit

Permalink
1.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxustudio committed Jun 11, 2024
1 parent ae37d43 commit 1392659
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 102 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
* @Author: xuranXYS
* @LastEditTime: 2024-04-21 20:51:31
* @LastEditTime: 2024-06-11 19:08:36
* @GitHub: www.github.com/xiaoxustudio
* @WebSite: www.xiaoxustudio.top
* @Description: By xuranXYS
Expand All @@ -11,10 +11,10 @@ All notable changes to the "webgal-for-vscode" extension will be documented in t

## [Unreleased]

## [1.4.6] - 2024.5.4
## [1.4.7] - 2024.6.11

- 增加配置文件hover提示
- 修复参数后资源链接匹配的问题
- 更新README
- 修复websocket连接失败问题

## [1.4.5] - 2024.4.21

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--
* @Author: xuranXYS
* @LastEditTime: 2024-04-21 20:53:31
* @LastEditTime: 2024-06-11 19:06:02
* @GitHub: www.github.com/xiaoxustudio
* @WebSite: www.xiaoxustudio.top
* @Description: By xuranXYS
Expand All @@ -16,7 +16,7 @@

<h4 align="center">WebGal Script 工具</h4>

![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen) ![github license](https://img.shields.io/github/license/xiaoxustudio/webgal-for-vscode) ![Language](https://img.shields.io/badge/language-webgal-brightgreen)
<h5 align="center"><img src="https://img.shields.io/badge/documentation-yes-brightgreen" alt="Documentation"> <img src="https://img.shields.io/github/license/xiaoxustudio/webgal-for-vscode" alt="github license"> <img src="https://img.shields.io/badge/language-webgal-brightgreen" alt="Language"></h5>

# 功能

Expand Down Expand Up @@ -51,7 +51,7 @@

# 使用

当前工作目录只要包含**config.txt**时,插件就会自动启动
当前工作目录**game**只要包含**config.txt**时,插件就会自动启动

或者使用启动命令自行启动插件

Expand All @@ -65,6 +65,8 @@

运行-添加配置-选择`webgal Debug`创建`launch.json`文件

*请自行ws地址:地址可F12在控制台看到,端口号一般为网页url的端口号*

运行即可,可在调试控制台查看指定变量、环境配置等信息

```txt
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "webgal-for-vscode",
"displayName": "webgal for VSCode",
"description": "webgal-for-vscode by xuran",
"version": "1.4.6",
"version": "1.4.7",
"repository": {
"type": "git",
"url": "https://github.com/xiaoxustudio/webgal-for-vscode"
Expand All @@ -15,8 +15,6 @@
"Programming Languages"
],
"activationEvents": [
"workspaceContains:config.txt",
"workspaceContains:**/config.txt",
"workspaceContains:**/game/config.txt"
],
"main": "./out/extension.js",
Expand Down Expand Up @@ -111,7 +109,7 @@
"ws": {
"type": "string",
"description": "WebSoket 地址",
"default": "ws://localhost:9999/"
"default": "ws://localhost:3001/api/webgalsync"
}
}
}
Expand All @@ -122,7 +120,7 @@
"request": "launch",
"name": "Launch Webgal Script",
"program": "${fileBasename}",
"ws": "ws://localhost:9999/"
"ws": "ws://localhost:3001/api/webgalsync"
}
],
"configurationSnippets": [
Expand All @@ -134,7 +132,7 @@
"request": "launch",
"name": "${2:Launch Webgal Script}",
"program": "${fileBasename}",
"ws": "ws://localhost:9999/"
"ws": "ws://localhost:3001/api/webgalsync"
}
}
]
Expand Down Expand Up @@ -214,10 +212,10 @@
"vscode-languageclient": "^9.0.1",
"vscode-languageserver": "^9.0.1",
"vscode-languageserver-textdocument": "^1.0.11",
"ws": "^8.16.0"
"ws": "^8.17.0"
},
"devDependencies": {
"@types/node": "^20.11.30",
"@types/ws": "^8.5.10"
}
}
}
6 changes: 3 additions & 3 deletions src/DebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import {
import { DebugProtocol } from "@vscode/debugprotocol";
import { getGameData } from "./utils/utils";
import { debug, DebugSession } from "vscode";
import XRRuntime, { RuntimeVariable } from "./ws";
import { FileAccessor } from "./utils/utils_novsc";
import XRRuntime from "./ws";
import { FileAccessor, RuntimeVariable } from "./utils/utils_novsc";
import { WebSocket } from "ws";
interface IAttachRequestArguments extends ILaunchRequestArguments {}
interface ILaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
Expand Down Expand Up @@ -67,7 +67,7 @@ export class XRDebugSession extends LoggingDebugSession {
response.body.supportsBreakpointLocationsRequest = false;
response.body.supportsInstructionBreakpoints = false;
response.body.supportsHitConditionalBreakpoints = false;

this.sendResponse(response);
console.log("(webgal)initializing");
this.sendEvent(new InitializedEvent());
Expand Down
22 changes: 13 additions & 9 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* @Author: xuranXYS
* @LastEditTime: 2024-05-04 02:57:20
* @LastEditTime: 2024-06-11 13:16:14
* @GitHub: www.github.com/xiaoxustudio
* @WebSite: www.xiaoxustudio.top
* @Description: By xuranXYS
Expand Down Expand Up @@ -33,6 +33,7 @@ import { XRInlayHintsProvider } from "./provider/InlayHintProvider";
import { XRDocumentLinkProvider } from "./provider/DocumentLinkProvider";
import { XRDebugAdapterDescriptorFactory } from "./activeDebug";
import { XRDebugConfigurationProvider } from "./ws/config";
import { IDebugMessage, DebugCommand } from "./utils/utils_novsc";

let client: LanguageClient;
let run_Skip_Check = false;
Expand Down Expand Up @@ -107,14 +108,17 @@ function InitPlugin(context: ExtensionContext) {
active.document.fileName.lastIndexOf("\\") + 1
);
const line_number = active.selection.start.line;
const msg = {
command: 0,
sceneMsg: {
scene: scene_name,
sentence: line_number + 1,
}, // @ts-ignore
stageSyncMsg: {},
message: "Sync",
const msg: IDebugMessage = {
event: "message",
data: {
command: DebugCommand.JUMP,
sceneMsg: {
scene: scene_name,
sentence: line_number + 1,
}, // @ts-ignore
stageSyncMsg: {},
message: "徐然",
},
};
_ws.send(JSON.stringify(msg));
}
Expand Down
58 changes: 57 additions & 1 deletion src/utils/utils_novsc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* @Author: xuranXYS
* @LastEditTime: 2024-03-30 13:58:15
* @LastEditTime: 2024-06-11 14:06:55
* @GitHub: www.github.com/xiaoxustudio
* @WebSite: www.xiaoxustudio.top
* @Description: By xuranXYS
Expand All @@ -13,6 +13,54 @@ export interface FileAccessor {
readFile(path: string): Promise<Uint8Array>;
writeFile(path: string, contents: Uint8Array): Promise<void>;
}
export class RuntimeVariable {
public reference?: number;
public desc?: "Array" | "Object" | string;
public get value() {
return this._value;
}

public set value(value: IRuntimeVariableType) {
this._value = value;
}

constructor(
public readonly name: string,
private _value: IRuntimeVariableType
) {}
}

export type IRuntimeVariableType =
| number
| boolean
| string
| RuntimeVariable[];

export enum DebugCommand {
// 跳转
JUMP,
// 同步自客户端
SYNCFC,
// 同步自编辑器
SYNCFE,
// 执行指令
EXE_COMMAND,
// 重新拉取模板样式文件
REFETCH_TEMPLATE_FILES,
}
export interface IDebugMessage {
event: string;
data: {
command: DebugCommand;
sceneMsg: {
sentence: number;
scene: string;
} ;
message: string;
stageSyncMsg: any;
};
}

export const fsAccessor: FileAccessor = {
isWindows: process.platform === "win32",
readFile(path: string): Promise<Uint8Array> {
Expand Down Expand Up @@ -105,3 +153,11 @@ export function get_var_type(var_text: string): string {
}
return ` ${label} `;
}

export function is_JSON(_likely_josn: any) {
try {
return !!JSON.parse(_likely_josn);
} catch {
return false;
}
}
Loading

0 comments on commit 1392659

Please sign in to comment.