This commit is contained in:
csh 2025-08-29 16:54:46 +08:00
parent 540d58e86f
commit 2c4e5ac28a
8 changed files with 39 additions and 22 deletions

View File

@ -1,13 +1,22 @@
// SYNTAX TEST "tsl" // SYNTAX TEST "tsl"
// 字符串,数字,注释
// 注释 TODO // 注释 TODO
// abc(); // TODO: 注释
a := "string"; // 字符串 {aaaaa TODO}
b := 123; // 数字 (* abcdef *)
c := 1.23; // 浮点数
a := "字符串函数func()";
// 数字
num6 := 123; // 数字
num7 := 1.23; // 浮点数
num1 := 0xAF123;
num2 := 0O12357;
num3 := 0B010111;
num4 := 1.2e-12;
num5 := +3E15;
// 字符串
string1 := '123';
string2 := "func2()";
// 类相关 // 类相关
type MyClass = class type MyClass = class
@ -44,7 +53,8 @@ data.items.count;
// 函数声明 // 函数声明
function f(); // 无参数 function f(); // 无参数
function f(a, b); // 参数无类型 function f(a, b); // 参数无类型
function f(a: real; b: DD); // 参数有类型 function f(a: real; b: DD); // 参数有类型1
function f(a: real, b: DD); // 参数有类型2
function f(a: real = 1; b: string = "123"; c: number = abc.CONST1): def; // 带返回类型 function f(a: real = 1; b: string = "123"; c: number = abc.CONST1): def; // 带返回类型
// 函数调用 // 函数调用

View File

@ -14,6 +14,11 @@ Notable changes to the `TSL` extension will be documented in thio file.
- `tsl.server.arguments`: `tsl-server`的启动参数 - `tsl.server.arguments`: `tsl-server`的启动参数
- `tsl.interpreter.executable`: `tsl`解释器的路径 - `tsl.interpreter.executable`: `tsl`解释器的路径
## [2.3.0]: 2025-08-29
- 支持`begin|else|do|then`等换行增加缩进
- 支持`end`等换行减少缩进
## [2.2.0]: 2025-07-02 ## [2.2.0]: 2025-07-02
- 代码重构 - 代码重构

View File

@ -22,15 +22,9 @@
["\"", "\""], ["\"", "\""],
["'", "'"] ["'", "'"]
], ],
"folding": {
"markers": {
"start": "^\\s*\\{\\s*$",
"end": "^\\s*\\}\\s*$"
}
},
"wordPattern": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b", "wordPattern": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b",
"indentationRules": { "indentationRules": {
"increaseIndentPattern": "^.*(\\{[^}\"']*|\\([^)\"']*|\\[[^\\]\"']*)$", "increaseIndentPattern": "^.*\\b([Bb][Ee][Gg][Ii][Nn]|[Dd][Oo]|[Tt][Hh][Ee][Nn]|[Ee][Ll][Ss][Ee])\\b.*$",
"decreaseIndentPattern": "^(.*\\*\\/)?\\s*[\\}\\]\\)].*$" "decreaseIndentPattern": "^\\s*\\b([Ee][Nn][Dd])\\b.*$"
} }
} }

View File

@ -1,12 +1,12 @@
{ {
"name": "tsl-devkit", "name": "tsl-devkit",
"version": "2.2.0", "version": "2.3.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "tsl-devkit", "name": "tsl-devkit",
"version": "2.2.0", "version": "2.3.0",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"vscode-languageclient": "^9.0.1" "vscode-languageclient": "^9.0.1"

View File

@ -1,7 +1,7 @@
{ {
"name": "tsl-tools", "name": "tsl-tools",
"displayName": "TSL", "displayName": "TSL",
"version": "2.3.1", "version": "2.3.0",
"description": "VSCode extension for TSL, with syntax highlighting, code completion, and formatting", "description": "VSCode extension for TSL, with syntax highlighting, code completion, and formatting",
"publisher": "csh", "publisher": "csh",
"homepage": "https://git.mytsl.cn/csh/tsl-devkit", "homepage": "https://git.mytsl.cn/csh/tsl-devkit",

View File

@ -45,10 +45,18 @@ export function activate(context: vscode.ExtensionContext) {
vscode.window.showErrorMessage( vscode.window.showErrorMessage(
"Cannot find tsl-server. Please install it globally or include it in your extension's server directory." "Cannot find tsl-server. Please install it globally or include it in your extension's server directory."
) )
} else { return
const serverOptions: ServerOptions = { }
run: {command: serverExe, transport: TransportKind.stdio, args: serverArguments},
debug: {command: serverExe, transport: TransportKind.stdio, args: serverArguments} const serverOptions: ServerOptions = {
run: {command: serverExe, transport: TransportKind.stdio, args: ['--log=trace', '--log-stderr']},
debug: {command: serverExe, transport: TransportKind.stdio, args: ['--log=trace', '--log-stderr']}
}
const clientOptions: LanguageClientOptions = {
documentSelector: [{scheme: 'file', language: 'tsl'}],
synchronize: {
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.tsl')
} }
const clientOptions: LanguageClientOptions = { const clientOptions: LanguageClientOptions = {

Binary file not shown.

Binary file not shown.