This commit is contained in:
csh
2025-09-28 10:08:45 +08:00
parent dc713e6893
commit 4385652791
11 changed files with 886 additions and 172 deletions
+83
View File
@@ -0,0 +1,83 @@
# TSL Tools for Vim
<p align="left">
<strong>强大的 TSL 语言开发工具集</strong><br>
为 VSCode 提供完整的 TSL 语言支持
</p>
<p align="left">
<img src="https://img.shields.io/badge/Vim-%3E%3D9.0-green.svg" alt="Vim">
</p>
## 🚀 快速安装
### 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"]
}
```