hx-lsp v0.2.0 发布啦。
现在已经可以用支持 vscode snippet
,和使用脚本来执行 CodeAction
了,提供了 vscode Variables
支持。另外增加了色彩 document/color
支持。
安装
从crate安装
cargo install --force hx-lsp
源码编译
git clone https://github.com/erasin/hx-lsp.git
cd hx-lsp
cargo install --path .
languages.toml 配置
[language-server.hx-lsp]
command = "hx-lsp"
[[language]]
name = "markdown"
language-servers = [ "marksman", "markdown-oxide", "hx-lsp" ]
CodeAction: actions
.
└── actions
├── html.json
└── markdown.json
Action 格式:
- title:
String
: 显示条目内容 - filter:
String
或Vec<String>
: Shell 脚本, 参数是选择区域内容以及替换字段Variables
,当为空或者返回true
,1
的时候则使用该交互Action。 - shell:
String
或Vec<String>
: Shell 脚本,参数是选择区域内容以及替换字段Variables
,返回字符串则替换选择区域的内容。 - description:
Option<String>
: 提示内容
选择区域的内容使用
Stdio::piped
传输,在脚本中使用$(cat)
捕捉,或者使用替换字段$TM_SELECTED_TEXT
。
/* actions/markdown.json */
{
"bold": {
"title": "bold",
"filter": "",
"shell": ["echo -n \"**${TM_SELECTED_TEXT}**\""],
"description": "bold"
},
"italic": {
"title": "italic",
"filter": "",
"shell": ["echo -n \"_${TM_SELECTED_TEXT}_\""],
"description": "italic"
}
}
/* actions/go.json */
{
"run main": {
"title": "run main",
"filter": "[[ \"$TM_CURRENT_LINE\" == *main* ]] && echo true || echo false",
"shell": [
"alacritty --hold --working-directory ${TM_DIRECTORY} -e go run ${TM_FILENAME};"
"notify-send \"Golang\" \"RUN: ${TM_FILENAME}\""
],
"description": "go run main"
},
"run main in tmux": {
"title": "tmux: go run main",
"filter": "[[ \"$(cat)\" == *main* ]] && echo true || echo false",
"shell": [
"tmux split-window -h -c ${WORKSPACE_FOLDER}; tmux send 'go run ${TM_FILENAME}' Enter"
],
"description": "go run main"
}
}
DocumentColor 色彩支持
- rgb
- rgb(255, 255, 255) 支持整数
- rgb(2.0, 255.0, 255.0) 支持浮点值
- rgb(100%, 0%, 50%) 支持百分比
- hsl
- hsl(240, 50%, 50%) 色相 0-360 度, 饱和度和亮度百分比。
- hsl(180, 0.5, 0.5) 浮点值
- hsv
- hsv(300, 100%, 100%) 色相 0-360 度, 饱和度和明度百分比。
- hsv(180, 0.5, 0.5) 浮点值
bevy color
- rgba(1.0, 0.0, 0.0, 0.5)
- srgb(1.0,0.0,0.0)
- srgba(1.0, 0.0, 0.0, 0.8)
- hsla(300, 100%, 100%, 0.5)
- hsva(180, 0.5, 0.5, 0.5)
Ext Link: https://github.com/erasin/hx-lsp/blob/main/README.zh-cn.md
1
共 0 条评论, 1 页
评论区
写评论还没有评论