diff --git a/README.md b/README.md index 15ffdc5..0e0a69e 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,48 @@ # TSL Devkit -该插件提供 `tsl` 语言的语法高亮以及`LSP`代码补全 +

+ 🚀 TSL 语言开发工具套件
+ 为主流编辑器提供完整的 TSL 语言支持 +

-支持`LSP`需要安装`nodejs` +

+ VSCode + Vim +

-## VSCode +## 📖 简介 -### 安装方式一(推荐) +TSL Devkit 是一套完整的 TSL 语言开发工具集,为开发者提供专业的编程体验。 -安装[vsix](./vscode/)扩展 +### ✨ 核心功能 -```bash -code --install-extension tsl-tools-1.0.0.vsix # 具体版本号以vsix文件为准 -``` +- 🎨 **语法高亮** - 智能代码着色,提升代码可读性 +- 🔧 **语言服务器 (LSP)** - 代码补全、错误诊断、跳转定义 +- 📝 **代码片段** - 常用代码模板,提高编码效率 -### 安装方式二 +## 🛠️ 支持的编辑器 -复制[vscode](./vscode)文件夹到`VSCode`扩展目录(建议更改文件夹名) +### VSCode -```txt -Windows: %USERPROFILE%\.vscode\extensions -macOS: ~/.vscode/extensions -Linux: ~/.vscode/extensions -``` +[查看 VSCode 指南](./vscode/README.md) -### 安装方式三 +### Vim -本项目`vscode`目录下执行 +[查看 Vim 指南](./vim/README.md) -```bash -npm install -npx vsce package +## 🤝 贡献 -# 安装 -code --install-extension tsl-tools-1.0.0.vsix # 具体版本号以vsix文件为准 -``` +我们欢迎各种形式的贡献! -## Vim +- 🐛 [报告 Bug](https://git.mytsl.cn/csh/tsl-devkit/issues) +- 💡 [提出新功能](https://git.mytsl.cn/csh/tsl-devkit/issues) +- 🔧 [提交 PR](https://git.mytsl.cn/csh/tsl-devkit/pulls) +- 📖 [改进文档](https://git.mytsl.cn/csh/tsl-devkit/wiki) -需要`vim 9.0`以上版本 +## 👥 维护者 -将[tsl.vim](./vim/tsl.vim)放入`~/.vim/syntax/` +- [@csh](https://git.mytsl.cn/csh) - 项目作者 -```vim -" vimrc加入,可同时支持tsl和tsf -autocmd BufNewFile,BufRead *.ts[lf] setf tsl -``` +## 🙏 致谢 -使用`LSP`,需要在你的`languageserver`设置相关的参数,以`coc.nvim`为例,需要在`coc-settings.json`设置如下内容 - -```json -"languageserver": { - "tsl-server": { - "command": "tsl-server", - "args": ["--log=trace", "--log=stderr"], - "filetypes": ["tsl", "tsf"] - } -} -``` +感谢所有为 TSL Devkit 做出贡献的开发者! diff --git a/vim/README.md b/vim/README.md new file mode 100644 index 0000000..9c93db2 --- /dev/null +++ b/vim/README.md @@ -0,0 +1,83 @@ +# TSL Tools for Vim + +

+ 强大的 TSL 语言开发工具集
+ 为 VSCode 提供完整的 TSL 语言支持 +

+

+ Vim +

+ +## 🚀 快速安装 + +### 1️⃣ 基础语法高亮 + +#### 手动安装 + +```bash +# 创建语法目录(如果不存在) +mkdir -p ~/.vim/syntax/ + +# 复制语法文件 +cp vim/tsl.vim ~/.vim/syntax/ +``` + +#### 配置文件关联 + +在你的 `~/.vimrc` + +```vim +" 自动识别 .tsl 和 .tsf 文件 +autocmd BufNewFile,BufRead *.ts[lf] setf tsl + +" 或者分开设置 +autocmd BufNewFile,BufRead *.tsl setf tsl +autocmd BufNewFile,BufRead *.tsf setf tsl +``` + +### 2️⃣ LSP 语言服务器配置 + +TSL 提供完整的 LSP 支持,包括代码补全、错误检查、跳转定义等功能。 + +#### 使用 coc.nvim + +编辑 `~/.vim/coc-settings.json` 或运行 `:CocConfig`: + +```json +{ + "languageserver": { + "tsl-server": { + "command": "tsl-server", + "args": ["--log=info", "--log=stderr", "--interpreter=~/tsl64"], + "filetypes": ["tsl", "tsf"] + } + } +} +``` + +| 参数 | 说明 | 默认值 | +| -------------------- | -------------------------------- | -------- | +| `--log` | 日志级别 (trace/info/warn/error) | `info` | +| `--log-stderr` | 输出日志到标准错误 | - | +| `--log-file=PATH` | 输出日志到文件 | - | +| `--interpreter=PATH` | TSL 解释器路径 | 自动检测 | + +更多参数使用`tsl-server --help`获取 + +### 3️⃣ 代码片段配置 + +#### coc-snippets + +1. 安装 coc-snippets: + + ```vim + :CocInstall coc-snippets + ``` + +2. 配置片段文件路径: + + ```json + { + "snippets.textmateSnippetsRoots": ["~/.vim/snippets"] + } + ``` diff --git a/vim/tsl.json b/vim/tsl.json new file mode 100644 index 0000000..6752449 --- /dev/null +++ b/vim/tsl.json @@ -0,0 +1,287 @@ +{ + "If Statement": { + "prefix": "if", + "body": [ + "if ${1:condition} then", + "begin", + "\t$0", + "end;" + ], + "description": "If statement" + }, + "If-Else Statement": { + "prefix": "ifelse", + "body": [ + "if ${1:condition} then", + "begin", + "\t$2", + "end", + "else", + "begin", + "\t$0", + "end;" + ], + "description": "If-else statement" + }, + "If-ElseIf-Else Statement": { + "prefix": "ifelif", + "body": [ + "if ${1:condition1} then", + "begin", + "\t$2", + "end", + "else if ${3:condition2} then", + "begin", + "\t$4", + "end", + "else", + "begin", + "\t$0", + "end;" + ], + "description": "If-elseif-else statement" + }, + "For Loop (To)": { + "prefix": "for", + "body": [ + "for ${1:i} := ${2:0} to ${3:10} do", + "begin", + "\t$0", + "end;" + ], + "description": "For loop with counter" + }, + "For Loop (DownTo)": { + "prefix": "fordown", + "body": [ + "for ${1:i} := ${2:10} downto ${3:0} do", + "begin", + "\t$0", + "end;" + ], + "description": "For loop with counter (downto)" + }, + "For-In Loop": { + "prefix": "forin", + "body": [ + "for ${1:key}, ${2:value} in ${3:collection} do", + "begin", + "\t$0", + "end;" + ], + "description": "For-in loop" + }, + "While Loop": { + "prefix": "while", + "body": [ + "while ${1:condition} do", + "begin", + "\t$0", + "end;" + ], + "description": "While loop" + }, + "Repeat-Until Loop": { + "prefix": "repeat", + "body": [ + "repeat", + "\t$0", + "until ${1:condition};" + ], + "description": "Repeat-until loop" + }, + "Case Statement": { + "prefix": "case", + "body": [ + "case ${1:expression} of", + "\t${2:value1}:", + "\tbegin", + "\t\t${3:statements}", + "\tend;", + "\t${4:value2}:", + "\tbegin", + "\t\t${5:statements}", + "\tend;", + "else", + "begin", + "\t$0", + "end", + "end;" + ], + "description": "Case statement" + }, + "Try-Except Block": { + "prefix": "try", + "body": [ + "try", + "\t$1", + "except", + "\t$0", + "end;" + ], + "description": "Try-except block" + }, + "Function Declaration": { + "prefix": "funcdecl", + "body": [ + "function ${1:functionName}(${2:})${3:: ${4:returnType}};$0" + ], + "description": "Function declaration only" + }, + "Function Implementation": { + "prefix": "func", + "body": [ + "function ${1:functionName}(${2:})${3:: ${4:returnType}};", + "begin", + "\t$0", + "end;" + ], + "description": "Function implementation" + }, + "Function with Parameters": { + "prefix": "funcparam", + "body": [ + "function ${1:functionName}(${2:param1}: ${3:type1}; ${4:param2}: ${5:type2})${6:: ${7:returnType}};", + "begin", + "\t$0", + "end;" + ], + "description": "Function with typed parameters" + }, + "Function with Var Parameters": { + "prefix": "funcvar", + "body": [ + "function ${1:functionName}(var ${2:param1}: ${3:type1}; ${4:param2}: ${5:type2})${6:: ${7:returnType}};", + "begin", + "\t$0", + "end;" + ], + "description": "Function with var/out parameters" + }, + "Anonymous Function": { + "prefix": "anonfunc", + "body": [ + "function(${1:})${2:: ${3:returnType}}", + "begin", + "\t$0", + "end" + ], + "description": "Anonymous function" + }, + "Unit Module": { + "prefix": "unit", + "body": [ + "unit ${1:UnitName};", + "", + "interface", + "\t$2", + "", + "implementation", + "\t$0", + "", + "end." + ], + "description": "Unit module structure" + }, + "Unit with Initialization": { + "prefix": "unitfull", + "body": [ + "unit ${1:UnitName};", + "", + "interface", + "\t${2:// public declarations}", + "", + "implementation", + "\t${3:// implementation}", + "", + "initialization", + "\t${4:// initialization code}", + "", + "finalization", + "\t${5:// cleanup code}", + "", + "end." + ], + "description": "Complete unit with initialization and finalization" + }, + "Class Definition": { + "prefix": "class", + "body": [ + "type ${1:ClassName} = class${2:(${3:ParentClass})}", + "\t${4:public}", + "\t\t$0", + "end;" + ], + "description": "Class definition" + }, + "Class with Public/Private": { + "prefix": "classfull", + "body": [ + "type ${1:ClassName} = class${2:(${3:ParentClass})}", + "\tpublic", + "\t\tfunction ${4:methodName}(${5:})${6:: ${7:returnType}};", + "\t\t$0", + "\tprotected", + "\t\t", + "\tprivate", + "\t\t", + "end;" + ], + "description": "Class with public/protected/private sections" + }, + "Class Method Implementation": { + "prefix": "classmethod", + "body": [ + "function ${1:ClassName}.${2:methodName}(${3:})${4:: ${5:returnType}};", + "begin", + "\t$0", + "end;" + ], + "description": "Class method implementation" + }, + "Class Method with Override": { + "prefix": "methodoverride", + "body": [ + "function ${1:methodName}(${2:})${3:: ${4:returnType}};", + "override;", + "begin", + "\t$0", + "end;" + ], + "description": "Override method in class" + }, + "Class Method with Virtual": { + "prefix": "methodvirtual", + "body": [ + "function ${1:methodName}(${2:})${3:: ${4:returnType}};", + "virtual;", + "begin", + "\t$0", + "end;" + ], + "description": "Virtual method in class" + }, + "Property Declaration": { + "prefix": "prop", + "body": [ + "property ${1:propertyName}: ${2:type} read ${3:getter} write ${4:setter};$0" + ], + "description": "Property with getter and setter" + }, + "Property Read Only": { + "prefix": "propread", + "body": [ + "property ${1:propertyName}: ${2:type} read ${3:getter};$0" + ], + "description": "Read-only property" + }, + "Begin-End Block": { + "prefix": "begin", + "body": [ + "begin", + "\t$0", + "end" + ], + "description": "Begin-end block" + } +} diff --git a/vim/tsl.vim b/vim/tsl.vim index 5c69542..6ea88ea 100644 --- a/vim/tsl.vim +++ b/vim/tsl.vim @@ -69,52 +69,40 @@ syn keyword tslMathConstant inf nan # todo syn keyword tslTodo FIXME NOTE NOTES TODO XXX contained +# Identifier +syn match tslIdentifier '\h\w*' + +# Operators and delimiters +syn match tslOperator '[+\-*/<>=!&|^~%]' +syn match tslDelimiter '[,;:.@?$]' + # Function definitions syn match tslFuncName '\%(\h\w*\.\)\?\h\w*' contained nextgroup=tslFuncParams skipwhite contains=tslTypeNameInFunc,tslDotInFunc syn match tslTypeNameInFunc '\h\w*\ze\.\h\w*' contained syn match tslDotInFunc '\.' contained -syn match tslFuncName '\.\@<=\h\w*' contained syn region tslFuncParams \ matchgroup=Delimiter \ start='(' \ end=')' \ contained - \ contains=tslParam,tslParamType,tslParamSep,tslNumber,tslString,tslPropertyChain + \ contains=tslParam,tslParamType,tslParamSep,tslNumber,tslString,tslPropertyChain,tslOperator \ nextgroup=tslReturnType skipwhite -syn match tslParam '\h\w*' contained nextgroup=tslParamType skipnl skipwhite +syn match tslParam '\h\w*' contained nextgroup=tslParamType skipwhite syn match tslParamType ':\s*[^;,)=]*' contained contains=tslColon syn match tslReturnType ':\s*[^;]*' contained contains=tslColon syn match tslParamSep '[;,]' contained syn match tslColon ':' contained # Property chain -syn match tslPropertyChain '\h\w*\%(\.\h\w*\)\+\>' contains=tslObjectName,tslPropertyDot,tslPropertyName -syn match tslObjectName '\h\w*\ze\.\h\w*' contained +syn match tslPropertyChain '\.\h\w*' contains=tslPropertyDot,tslPropertyName syn match tslPropertyDot '\.' contained -syn match tslPropertyName '\.\@<=\h\w*\%(\ze\.\|\ze\s*[^(]\|\ze\s*$\)' contained +syn match tslPropertyName '\h\w*' contained # Function calls -syn match tslFuncCallName '\%(\<\%(function\|procedure\)\s\+\%(\h\w*\.\)\?\)\@=!&|^~%]' -syn match tslDelimiter '[()[\]{},;:.@?]' +# 冒号的情况 +# 1. 简单赋值a := 1; 不需要匹配 +# 2. 三元表达式a ? b : c; 不需要匹配 +# 3. 普通类型变量声明 a: string; b: array of number; c: obj.A; 匹配:;中的字符,包括.和空格 +# 4. 声明类型时候有tag,比如[werkref]a: string; 不需要匹配[xxx],只需要和3一样匹配 +# 5. 变量声明时候带初始化a: number = 1; :=之间的内容是类型,=之后的内容由tslnumber,tslstring等匹配 +# 6. gloabl var 等是关键字,global a: string = "123"; 不能把global匹配为identifier +# 7. 多变量声明, global a, b: number = 1; // 需要匹配的类型是: =之间的number +# 8. 不能匹配到函数调用的指定参数模式func(a: 123; b: "sss"); # Comments syn match tslComment '//.*$' contains=tslTodo,@Spell -syn region tslComment start='(\*' end='\*)' contains=tslTodo,@Spell keepend syn region tslComment start='{' end='}' contains=tslTodo,@Spell keepend +syn region tslComment start='(\*' end='\*)' contains=tslTodo,@Spell keepend # Strings -syn region tslString start=+[uU]\=\z(['"]\)+ end='\z1' skip='\\\\\|\\\z1' -syn region tslRawString start=+[uU]\=[rR]\z(['"]\)+ end='\z1' skip='\\\\\|\\\z1' +syn region tslString start=+[uU]\=\z(['"]\)+ end='\z1' skip='\\\z1' +syn region tslRawString start=+[uU]\=[rR]\z(['"]\)+ end='\z1' # Numbers -syn match tslNumber '\<0[oO]\=\o\+[Ll]\=\>' syn match tslNumber '\<0[xX]\x\+[Ll]\=\>' +syn match tslNumber '\<0[oO]\o\+[Ll]\=\>' syn match tslNumber '\<0[bB][01]\+[Ll]\=\>' -syn match tslNumber '\<\%([1-9]\d*\|0\)[Ll]\=\>' -syn match tslNumber '\<\d\+[jJ]\>' -syn match tslNumber '\<\d\+[eE][+-]\=\d\+[jJ]\=\>' -syn match tslNumber '\<\d\+\.\%([eE][+-]\=\d\+\)\=[jJ]\=\%(\W\|$\)\@=' -syn match tslNumber '\%(^\|\W\)\zs\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>' +syn match tslNumber '\<\d\+\%(\.\d*\)\=\%([eE][+-]\=\d\+\)\=[jJlL]\=\>' # Highlight links @@ -161,7 +150,7 @@ hi def link tslProgramStructure Statement hi def link tslModuleStructure Statement hi def link tslPrimitiveType Type hi def link tslClassType Statement -hi def link tslClassModifier Identifier +hi def link tslClassModifier StorageClass hi def link tslAccessModifier Statement hi def link tslPropertyAccessor Operator hi def link tslConstructor Special @@ -185,16 +174,16 @@ hi def link tslSqlOperator Special hi def link tslSystemKeyword Special hi def link tslCallingConvention Special hi def link tslBuiltinVar Constant -hi def link tslBuiltinFunction Constant +hi def link tslBuiltinFunction Special hi def link tslBoolean Boolean hi def link tslNull Constant hi def link tslMathConstant Number -# 其他元素的高亮链接保持不变 -hi def link tslObjectName Type hi def link tslPropertyDot Operator hi def link tslPropertyName Special +hi def link tslFuncCallName Function + hi def link tslFuncName Function hi def link tslTypeNameInFunc Type hi def link tslParam Identifier @@ -206,11 +195,7 @@ hi def link tslColon Delimiter hi def link tslVarName Identifier hi def link tslVarType Type -hi def link tslFuncCallName Function -hi def link tslCallParam Identifier -hi def link tslCallValue Type -hi def link tslCallSep Delimiter - +hi def link tslIdentifier PreProc hi def link tslOperator Operator hi def link tslDelimiter Delimiter hi def link tslTodo Todo diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index 48656c9..9e53685 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -2,6 +2,11 @@ Notable changes to the `TSL` extension will be documented in thio file. +## [3.0.0]: 2025-09-28 + +- 支持`lsp`全局函数补全 +- 降低`vscode`支持版本到`1.90.0` + ## [2.3.1]: 2025-07-10 - 修复:关键字`initialization`拼写错误 diff --git a/vscode/README.md b/vscode/README.md index 75aa01e..04a23fa 100644 --- a/vscode/README.md +++ b/vscode/README.md @@ -1,7 +1,80 @@ -# TSL-Devkit +# TSL Tools for VSCode -`tsl`的`vscode`插件工具集 +

+ 强大的 TSL 语言开发工具集
+ 为 VSCode 提供完整的 TSL 语言支持 +

-- 支持`textMate`语法高亮 -- 支持`LSP`补全 +## ✨ 功能特性 +- 🎨 **语法高亮** - 基于 TextMate 语法的智能代码着色 +- 🔧 **语言服务器协议 (LSP)** - 提供智能代码补全、错误检查、跳转定义等功能 +- 📝 **代码片段 (Snippets)** - 快速插入常用代码模板 + +## 📦 安装方式 + +### 方式一:通过 VSIX 文件安装(推荐) + +直接使用预编译的扩展包: + +```bash +# 命令行安装 +code --install-extension tsl-tools-3.0.0.vsix +``` + +或者在 VSCode 中: + +1. 打开命令面板 (`Ctrl+Shift+P` / `Cmd+Shift+P`) +2. 输入 `Install from VSIX` +3. 选择 `tsl-tools-3.0.0.vsix` 文件 + +### 方式二:从源码构建 + +```bash +# 克隆仓库 +git clone https://git.mytsl.cn/csh/tsl-devkit.git +cd tsl-devkit + +# 安装依赖 +npm install + +# 打包扩展 +npx vsce package + +# 安装生成的 VSIX 文件 +code --install-extension tsl-tools-3.0.0.vsix +``` + +### 方式三:手动安装 + +将扩展文件夹复制到 VSCode 扩展目录: + +| 操作系统 | 扩展目录路径 | +| -------- | ---------------------------------- | +| Windows | `%USERPROFILE%\.vscode\extensions` | +| macOS | `~/.vscode/extensions` | +| Linux | `~/.vscode/extensions` | + +## ⚙️ 配置选项 + +在 VSCode 设置中配置 TSL 扩展: + +### 语言服务器配置 + +| 配置项 | 类型 | 默认值 | 描述 | +| --- | --- | --- | --- | +| `tsl.server.executable` | `string` | `""` | TSL 语言服务器可执行文件路径
_留空自动检测_ | +| `tsl.server.arguments` | `string[]` | `["--log=trace", "--log-stderr"]` | 语言服务器启动参数
_使用 `./tsl-server --help` 查看所有选项_ | +| `tsl.interpreter.executable` | `string` | `""` | TSL 解释器路径
_用于识别 funcext 下的 .tsf 文件_ | + +### 配置示例 + +```json +{ + "tsl.server.executable": "/usr/local/bin/tsl-server", + "tsl.server.arguments": ["--log=info", "--log-stderr"], + "tsl.interpreter.executable": "/usr/local/bin/tsl" +} +``` + +> ⚠️ **注意**: `tsl.interpreter.executable` 与服务器参数 `--interpreter=PATH` 冲突,请只使用其中一个 diff --git a/vscode/package-lock.json b/vscode/package-lock.json index ef723e1..a41e7ce 100644 --- a/vscode/package-lock.json +++ b/vscode/package-lock.json @@ -1,25 +1,25 @@ { "name": "tsl-tools", - "version": "2.4.0", + "version": "3.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tsl-tools", - "version": "2.4.0", + "version": "3.0.0", "license": "AGPL-3.0-or-later", "dependencies": { "vscode-languageclient": "^9.0.1" }, "devDependencies": { - "@types/node": "^24.0.3", - "@types/vscode": "^1.101.0", + "@types/node": "^24.5.2", + "@types/vscode": "^1.90.0", "@vscode/vsce": "^3.6.0", - "prettier": "^3.5.3", - "typescript": "^5.8.3" + "prettier": "^3.6.2", + "typescript": "^5.9.2" }, "engines": { - "vscode": "^1.101.0" + "vscode": "^1.90.0" } }, "node_modules/@azu/format-text": { @@ -171,22 +171,22 @@ } }, "node_modules/@azure/msal-browser": { - "version": "4.23.0", - "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.23.0.tgz", - "integrity": "sha512-uHnfRwGAEHaYVXzpCtYsruy6PQxL2v76+MJ3+n/c/3PaTiTIa5ch7VofTUNoA39nHyjJbdiqTwFZK40OOTOkjw==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.24.0.tgz", + "integrity": "sha512-BNoiUEx4olj16U9ZiquvIhG1dZBnwWSzSXiSclq/9qiFQXYeLOKqEaEv98+xLXJ3oLw9APwHTR1eY2Qk0v6XBQ==", "dev": true, "license": "MIT", "dependencies": { - "@azure/msal-common": "15.12.0" + "@azure/msal-common": "15.13.0" }, "engines": { "node": ">=0.8.0" } }, "node_modules/@azure/msal-common": { - "version": "15.12.0", - "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.12.0.tgz", - "integrity": "sha512-4ucXbjVw8KJ5QBgnGJUeA07c8iznwlk5ioHIhI4ASXcXgcf2yRFhWzYOyWg/cI49LC9ekpFJeQtO3zjDTbl6TQ==", + "version": "15.13.0", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.13.0.tgz", + "integrity": "sha512-8oF6nj02qX7eE/6+wFT5NluXRHc05AgdCC3fJnkjiJooq8u7BcLmxaYYSwc2AfEkWRMRi6Eyvvbeqk4U4412Ag==", "dev": true, "license": "MIT", "engines": { @@ -194,13 +194,13 @@ } }, "node_modules/@azure/msal-node": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.7.4.tgz", - "integrity": "sha512-fjqvhrThwzzPvqhFOdkkGRJCHPQZTNijpceVy8QjcfQuH482tOVEjHyamZaioOhVtx+FK1u+eMpJA2Zz4U9LVg==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.8.0.tgz", + "integrity": "sha512-23BXm82Mp5XnRhrcd4mrHa0xuUNRp96ivu3nRatrfdAqjoeWAGyD0eEAafxAOHAEWWmdlyFK4ELFcdziXyw2sA==", "dev": true, "license": "MIT", "dependencies": { - "@azure/msal-common": "15.12.0", + "@azure/msal-common": "15.13.0", "jsonwebtoken": "^9.0.0", "uuid": "^8.3.0" }, @@ -655,17 +655,17 @@ } }, "node_modules/@vscode/vsce": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.6.0.tgz", - "integrity": "sha512-u2ZoMfymRNJb14aHNawnXJtXHLXDVKc1oKZaH4VELKT/9iWKRVgtQOdwxCgtwSxJoqYvuK4hGlBWQJ05wxADhg==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.6.2.tgz", + "integrity": "sha512-gvBfarWF+Ii20ESqjA3dpnPJpQJ8fFJYtcWtjwbRADommCzGg1emtmb34E+DKKhECYvaVyAl+TF9lWS/3GSPvg==", "dev": true, "license": "MIT", "dependencies": { "@azure/identity": "^4.1.0", - "@secretlint/node": "^10.1.1", - "@secretlint/secretlint-formatter-sarif": "^10.1.1", - "@secretlint/secretlint-rule-no-dotenv": "^10.1.1", - "@secretlint/secretlint-rule-preset-recommend": "^10.1.1", + "@secretlint/node": "^10.1.2", + "@secretlint/secretlint-formatter-sarif": "^10.1.2", + "@secretlint/secretlint-rule-no-dotenv": "^10.1.2", + "@secretlint/secretlint-rule-preset-recommend": "^10.1.2", "@vscode/vsce-sign": "^2.0.0", "azure-devops-node-api": "^12.5.0", "chalk": "^4.1.2", @@ -682,7 +682,7 @@ "minimatch": "^3.0.3", "parse-semver": "^1.1.1", "read": "^1.0.7", - "secretlint": "^10.1.1", + "secretlint": "^10.1.2", "semver": "^7.5.2", "tmp": "^0.2.3", "typed-rest-client": "^1.8.4", @@ -702,28 +702,28 @@ } }, "node_modules/@vscode/vsce-sign": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.6.tgz", - "integrity": "sha512-j9Ashk+uOWCDHYDxgGsqzKq5FXW9b9MW7QqOIYZ8IYpneJclWTBeHZz2DJCSKQgo+JAqNcaRRE1hzIx0dswqAw==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.7.tgz", + "integrity": "sha512-cz0GFW8qCxpypOy3y509u26K1FIPMlDIHBwGmDyvEbgoma2v3y5YIHHuijr8zCYBp9kzCCOJd28s/0PG7cA7ew==", "dev": true, "hasInstallScript": true, "license": "SEE LICENSE IN LICENSE.txt", "optionalDependencies": { - "@vscode/vsce-sign-alpine-arm64": "2.0.5", - "@vscode/vsce-sign-alpine-x64": "2.0.5", - "@vscode/vsce-sign-darwin-arm64": "2.0.5", - "@vscode/vsce-sign-darwin-x64": "2.0.5", - "@vscode/vsce-sign-linux-arm": "2.0.5", - "@vscode/vsce-sign-linux-arm64": "2.0.5", - "@vscode/vsce-sign-linux-x64": "2.0.5", - "@vscode/vsce-sign-win32-arm64": "2.0.5", - "@vscode/vsce-sign-win32-x64": "2.0.5" + "@vscode/vsce-sign-alpine-arm64": "2.0.6", + "@vscode/vsce-sign-alpine-x64": "2.0.6", + "@vscode/vsce-sign-darwin-arm64": "2.0.6", + "@vscode/vsce-sign-darwin-x64": "2.0.6", + "@vscode/vsce-sign-linux-arm": "2.0.6", + "@vscode/vsce-sign-linux-arm64": "2.0.6", + "@vscode/vsce-sign-linux-x64": "2.0.6", + "@vscode/vsce-sign-win32-arm64": "2.0.6", + "@vscode/vsce-sign-win32-x64": "2.0.6" } }, "node_modules/@vscode/vsce-sign-alpine-arm64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.5.tgz", - "integrity": "sha512-XVmnF40APwRPXSLYA28Ye+qWxB25KhSVpF2eZVtVOs6g7fkpOxsVnpRU1Bz2xG4ySI79IRuapDJoAQFkoOgfdQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.6.tgz", + "integrity": "sha512-wKkJBsvKF+f0GfsUuGT0tSW0kZL87QggEiqNqK6/8hvqsXvpx8OsTEc3mnE1kejkh5r+qUyQ7PtF8jZYN0mo8Q==", "cpu": [ "arm64" ], @@ -735,9 +735,9 @@ ] }, "node_modules/@vscode/vsce-sign-alpine-x64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.5.tgz", - "integrity": "sha512-JuxY3xcquRsOezKq6PEHwCgd1rh1GnhyH6urVEWUzWn1c1PC4EOoyffMD+zLZtFuZF5qR1I0+cqDRNKyPvpK7Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.6.tgz", + "integrity": "sha512-YoAGlmdK39vKi9jA18i4ufBbd95OqGJxRvF3n6ZbCyziwy3O+JgOpIUPxv5tjeO6gQfx29qBivQ8ZZTUF2Ba0w==", "cpu": [ "x64" ], @@ -749,9 +749,9 @@ ] }, "node_modules/@vscode/vsce-sign-darwin-arm64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.5.tgz", - "integrity": "sha512-z2Q62bk0ptADFz8a0vtPvnm6vxpyP3hIEYMU+i1AWz263Pj8Mc38cm/4sjzxu+LIsAfhe9HzvYNS49lV+KsatQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.6.tgz", + "integrity": "sha512-5HMHaJRIQuozm/XQIiJiA0W9uhdblwwl2ZNDSSAeXGO9YhB9MH5C4KIHOmvyjUnKy4UCuiP43VKpIxW1VWP4tQ==", "cpu": [ "arm64" ], @@ -763,9 +763,9 @@ ] }, "node_modules/@vscode/vsce-sign-darwin-x64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.5.tgz", - "integrity": "sha512-ma9JDC7FJ16SuPXlLKkvOD2qLsmW/cKfqK4zzM2iJE1PbckF3BlR08lYqHV89gmuoTpYB55+z8Y5Fz4wEJBVDA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.6.tgz", + "integrity": "sha512-25GsUbTAiNfHSuRItoQafXOIpxlYj+IXb4/qarrXu7kmbH94jlm5sdWSCKrrREs8+GsXF1b+l3OB7VJy5jsykw==", "cpu": [ "x64" ], @@ -777,9 +777,9 @@ ] }, "node_modules/@vscode/vsce-sign-linux-arm": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.5.tgz", - "integrity": "sha512-cdCwtLGmvC1QVrkIsyzv01+o9eR+wodMJUZ9Ak3owhcGxPRB53/WvrDHAFYA6i8Oy232nuen1YqWeEohqBuSzA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.6.tgz", + "integrity": "sha512-UndEc2Xlq4HsuMPnwu7420uqceXjs4yb5W8E2/UkaHBB9OWCwMd3/bRe/1eLe3D8kPpxzcaeTyXiK3RdzS/1CA==", "cpu": [ "arm" ], @@ -791,9 +791,9 @@ ] }, "node_modules/@vscode/vsce-sign-linux-arm64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.5.tgz", - "integrity": "sha512-Hr1o0veBymg9SmkCqYnfaiUnes5YK6k/lKFA5MhNmiEN5fNqxyPUCdRZMFs3Ajtx2OFW4q3KuYVRwGA7jdLo7Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.6.tgz", + "integrity": "sha512-cfb1qK7lygtMa4NUl2582nP7aliLYuDEVpAbXJMkDq1qE+olIw/es+C8j1LJwvcRq1I2yWGtSn3EkDp9Dq5FdA==", "cpu": [ "arm64" ], @@ -805,9 +805,9 @@ ] }, "node_modules/@vscode/vsce-sign-linux-x64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.5.tgz", - "integrity": "sha512-XLT0gfGMcxk6CMRLDkgqEPTyG8Oa0OFe1tPv2RVbphSOjFWJwZgK3TYWx39i/7gqpDHlax0AP6cgMygNJrA6zg==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.6.tgz", + "integrity": "sha512-/olerl1A4sOqdP+hjvJ1sbQjKN07Y3DVnxO4gnbn/ahtQvFrdhUi0G1VsZXDNjfqmXw57DmPi5ASnj/8PGZhAA==", "cpu": [ "x64" ], @@ -819,9 +819,9 @@ ] }, "node_modules/@vscode/vsce-sign-win32-arm64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.5.tgz", - "integrity": "sha512-hco8eaoTcvtmuPhavyCZhrk5QIcLiyAUhEso87ApAWDllG7djIrWiOCtqn48k4pHz+L8oCQlE0nwNHfcYcxOPw==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.6.tgz", + "integrity": "sha512-ivM/MiGIY0PJNZBoGtlRBM/xDpwbdlCWomUWuLmIxbi1Cxe/1nooYrEQoaHD8ojVRgzdQEUzMsRbyF5cJJgYOg==", "cpu": [ "arm64" ], @@ -833,9 +833,9 @@ ] }, "node_modules/@vscode/vsce-sign-win32-x64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.5.tgz", - "integrity": "sha512-1ixKFGM2FwM+6kQS2ojfY3aAelICxjiCzeg4nTHpkeU1Tfs4RC+lVLrgq5NwcBC7ZLr6UfY3Ct3D6suPeOf7BQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.6.tgz", + "integrity": "sha512-mgth9Kvze+u8CruYMmhHw6Zgy3GRX2S+Ed5oSokDEK5vPEwGGKnmuXua9tmFhomeAnhgJnL4DCna3TiNuGrBTQ==", "cpu": [ "x64" ], @@ -874,9 +874,9 @@ } }, "node_modules/ansi-escapes": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.1.0.tgz", - "integrity": "sha512-YdhtCd19sKRKfAAUsrcC1wzm4JuzJoiX4pOJqIoW2qmKj5WzG/dL8uUJ0361zaXtHqK7gEhOwtAtz7t3Yq3X5g==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.1.1.tgz", + "integrity": "sha512-Zhl0ErHcSRUaVfGUeUdDuLgpkEo8KIFjB4Y9uAc46ScOpdDiU1Dbyplh7qWJeJ/ZHpbyMSM26+X3BySgnIz40Q==", "dev": true, "license": "MIT", "dependencies": { @@ -1415,9 +1415,9 @@ } }, "node_modules/detect-libc": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.0.tgz", - "integrity": "sha512-vEtk+OcP7VBRtQZ1EJ3bdgzSfBjgnEalLTp5zjJrS+2Z1w2KZly4SBdac/WDU3hhsNAZ9E8SC96ME4Ey8MZ7cg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.1.tgz", + "integrity": "sha512-ecqj/sy1jcK1uWrwpR67UhYrIFQ+5WlGxth34WquCbamhFA6hkkwiu37o6J5xCHdo1oixJRfVRw+ywV+Hq/0Aw==", "dev": true, "license": "Apache-2.0", "optional": true, @@ -2119,9 +2119,9 @@ } }, "node_modules/index-to-position": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.1.0.tgz", - "integrity": "sha512-XPdx9Dq4t9Qk1mTMbWONJqU7boCoumEH7fRET37HX5+khDUl3J2W6PdALxhILYlIYx2amlwYcRPp28p0tSiojg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.2.0.tgz", + "integrity": "sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==", "dev": true, "license": "MIT", "engines": { @@ -2944,9 +2944,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "11.2.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.1.tgz", - "integrity": "sha512-r8LA6i4LP4EeWOhqBaZZjDWwehd1xUJPCJd9Sv300H0ZmcUER4+JPh7bqqZeqs1o5pgtgvXm+d9UGrB5zZGDiQ==", + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.2.tgz", + "integrity": "sha512-F9ODfyqML2coTIsQpSkRHnLSZMtkU8Q+mSfcaIyKwy58u+8k5nvAYeiNhsyMARvzNcXJ9QfWVrcPsC9e9rAxtg==", "dev": true, "license": "ISC", "engines": { diff --git a/vscode/package.json b/vscode/package.json index a1d0656..37b8e1e 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -1,7 +1,7 @@ { "name": "tsl-tools", "displayName": "TSL", - "version": "2.4.0", + "version": "3.0.0", "description": "VSCode extension for TSL, with syntax highlighting, code completion, and formatting", "publisher": "csh", "homepage": "https://git.mytsl.cn/csh/tsl-devkit", @@ -43,6 +43,12 @@ "path": "./syntaxes/tsl.tmLanguage.json" } ], + "snippets": [ + { + "language": "tsl", + "path": "./snippets/tsl.json" + } + ], "configuration": { "type": "object", "title": "TSL", @@ -55,7 +61,7 @@ "tsl.server.arguments": { "type": "array", "default": [ - "--log=trace", + "--log=info", "--log-stderr" ], "description": "Arguments for TSL server", @@ -84,13 +90,13 @@ }, "devDependencies": { "@types/node": "^24.5.2", - "@types/vscode": "^1.101.0", + "@types/vscode": "^1.90.0", "@vscode/vsce": "^3.6.0", "prettier": "^3.6.2", "typescript": "^5.9.2" }, "engines": { - "vscode": "^1.101.0" + "vscode": "^1.90.0" }, "dependencies": { "vscode-languageclient": "^9.0.1" diff --git a/vscode/snippets/tsl.json b/vscode/snippets/tsl.json new file mode 100644 index 0000000..6752449 --- /dev/null +++ b/vscode/snippets/tsl.json @@ -0,0 +1,287 @@ +{ + "If Statement": { + "prefix": "if", + "body": [ + "if ${1:condition} then", + "begin", + "\t$0", + "end;" + ], + "description": "If statement" + }, + "If-Else Statement": { + "prefix": "ifelse", + "body": [ + "if ${1:condition} then", + "begin", + "\t$2", + "end", + "else", + "begin", + "\t$0", + "end;" + ], + "description": "If-else statement" + }, + "If-ElseIf-Else Statement": { + "prefix": "ifelif", + "body": [ + "if ${1:condition1} then", + "begin", + "\t$2", + "end", + "else if ${3:condition2} then", + "begin", + "\t$4", + "end", + "else", + "begin", + "\t$0", + "end;" + ], + "description": "If-elseif-else statement" + }, + "For Loop (To)": { + "prefix": "for", + "body": [ + "for ${1:i} := ${2:0} to ${3:10} do", + "begin", + "\t$0", + "end;" + ], + "description": "For loop with counter" + }, + "For Loop (DownTo)": { + "prefix": "fordown", + "body": [ + "for ${1:i} := ${2:10} downto ${3:0} do", + "begin", + "\t$0", + "end;" + ], + "description": "For loop with counter (downto)" + }, + "For-In Loop": { + "prefix": "forin", + "body": [ + "for ${1:key}, ${2:value} in ${3:collection} do", + "begin", + "\t$0", + "end;" + ], + "description": "For-in loop" + }, + "While Loop": { + "prefix": "while", + "body": [ + "while ${1:condition} do", + "begin", + "\t$0", + "end;" + ], + "description": "While loop" + }, + "Repeat-Until Loop": { + "prefix": "repeat", + "body": [ + "repeat", + "\t$0", + "until ${1:condition};" + ], + "description": "Repeat-until loop" + }, + "Case Statement": { + "prefix": "case", + "body": [ + "case ${1:expression} of", + "\t${2:value1}:", + "\tbegin", + "\t\t${3:statements}", + "\tend;", + "\t${4:value2}:", + "\tbegin", + "\t\t${5:statements}", + "\tend;", + "else", + "begin", + "\t$0", + "end", + "end;" + ], + "description": "Case statement" + }, + "Try-Except Block": { + "prefix": "try", + "body": [ + "try", + "\t$1", + "except", + "\t$0", + "end;" + ], + "description": "Try-except block" + }, + "Function Declaration": { + "prefix": "funcdecl", + "body": [ + "function ${1:functionName}(${2:})${3:: ${4:returnType}};$0" + ], + "description": "Function declaration only" + }, + "Function Implementation": { + "prefix": "func", + "body": [ + "function ${1:functionName}(${2:})${3:: ${4:returnType}};", + "begin", + "\t$0", + "end;" + ], + "description": "Function implementation" + }, + "Function with Parameters": { + "prefix": "funcparam", + "body": [ + "function ${1:functionName}(${2:param1}: ${3:type1}; ${4:param2}: ${5:type2})${6:: ${7:returnType}};", + "begin", + "\t$0", + "end;" + ], + "description": "Function with typed parameters" + }, + "Function with Var Parameters": { + "prefix": "funcvar", + "body": [ + "function ${1:functionName}(var ${2:param1}: ${3:type1}; ${4:param2}: ${5:type2})${6:: ${7:returnType}};", + "begin", + "\t$0", + "end;" + ], + "description": "Function with var/out parameters" + }, + "Anonymous Function": { + "prefix": "anonfunc", + "body": [ + "function(${1:})${2:: ${3:returnType}}", + "begin", + "\t$0", + "end" + ], + "description": "Anonymous function" + }, + "Unit Module": { + "prefix": "unit", + "body": [ + "unit ${1:UnitName};", + "", + "interface", + "\t$2", + "", + "implementation", + "\t$0", + "", + "end." + ], + "description": "Unit module structure" + }, + "Unit with Initialization": { + "prefix": "unitfull", + "body": [ + "unit ${1:UnitName};", + "", + "interface", + "\t${2:// public declarations}", + "", + "implementation", + "\t${3:// implementation}", + "", + "initialization", + "\t${4:// initialization code}", + "", + "finalization", + "\t${5:// cleanup code}", + "", + "end." + ], + "description": "Complete unit with initialization and finalization" + }, + "Class Definition": { + "prefix": "class", + "body": [ + "type ${1:ClassName} = class${2:(${3:ParentClass})}", + "\t${4:public}", + "\t\t$0", + "end;" + ], + "description": "Class definition" + }, + "Class with Public/Private": { + "prefix": "classfull", + "body": [ + "type ${1:ClassName} = class${2:(${3:ParentClass})}", + "\tpublic", + "\t\tfunction ${4:methodName}(${5:})${6:: ${7:returnType}};", + "\t\t$0", + "\tprotected", + "\t\t", + "\tprivate", + "\t\t", + "end;" + ], + "description": "Class with public/protected/private sections" + }, + "Class Method Implementation": { + "prefix": "classmethod", + "body": [ + "function ${1:ClassName}.${2:methodName}(${3:})${4:: ${5:returnType}};", + "begin", + "\t$0", + "end;" + ], + "description": "Class method implementation" + }, + "Class Method with Override": { + "prefix": "methodoverride", + "body": [ + "function ${1:methodName}(${2:})${3:: ${4:returnType}};", + "override;", + "begin", + "\t$0", + "end;" + ], + "description": "Override method in class" + }, + "Class Method with Virtual": { + "prefix": "methodvirtual", + "body": [ + "function ${1:methodName}(${2:})${3:: ${4:returnType}};", + "virtual;", + "begin", + "\t$0", + "end;" + ], + "description": "Virtual method in class" + }, + "Property Declaration": { + "prefix": "prop", + "body": [ + "property ${1:propertyName}: ${2:type} read ${3:getter} write ${4:setter};$0" + ], + "description": "Property with getter and setter" + }, + "Property Read Only": { + "prefix": "propread", + "body": [ + "property ${1:propertyName}: ${2:type} read ${3:getter};$0" + ], + "description": "Read-only property" + }, + "Begin-End Block": { + "prefix": "begin", + "body": [ + "begin", + "\t$0", + "end" + ], + "description": "Begin-end block" + } +} diff --git a/vscode/tsl-tools-2.4.0.vsix b/vscode/tsl-tools-2.4.0.vsix deleted file mode 100644 index 2f78903..0000000 Binary files a/vscode/tsl-tools-2.4.0.vsix and /dev/null differ diff --git a/vscode/tsl-tools-3.0.0.vsix b/vscode/tsl-tools-3.0.0.vsix new file mode 100644 index 0000000..41bf712 Binary files /dev/null and b/vscode/tsl-tools-3.0.0.vsix differ