From cebfa8df970fab344aa8f0450a6240c5c0154043 Mon Sep 17 00:00:00 2001 From: mityu Date: Mon, 9 Dec 2024 22:48:31 +0900 Subject: [PATCH] feat: Add tinymist for Typst --- README.md | 1 + installer/install-tinymist.cmd | 4 ++++ installer/install-tinymist.sh | 29 +++++++++++++++++++++++++++++ settings.json | 12 ++++++++++++ settings/tinymist.vim | 14 ++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 installer/install-tinymist.cmd create mode 100755 installer/install-tinymist.sh create mode 100644 settings/tinymist.vim diff --git a/README.md b/README.md index cc7c6f71..5e5932ba 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d | TypeScript | eslint-language-server | Yes | Yes | | TypeScript | biome | Yes | Yes | | Typst | typst-lsp | Yes | Yes | +| Typst | tinymist | Yes | Yes | | Vim | vim-language-server | Yes | Yes | | Vala | vala-language-server | No | No | | Verilog | verible-verilog-ls | UNIX Only | Yes | diff --git a/installer/install-tinymist.cmd b/installer/install-tinymist.cmd new file mode 100644 index 00000000..740cbcaa --- /dev/null +++ b/installer/install-tinymist.cmd @@ -0,0 +1,4 @@ +@echo off + +setlocal +curl -L -o tinymist.exe "https://github.com/Myriad-Dreamin/tinymist/releases/latest/download/tinymist-win32-x64.exe" diff --git a/installer/install-tinymist.sh b/installer/install-tinymist.sh new file mode 100755 index 00000000..b17cf939 --- /dev/null +++ b/installer/install-tinymist.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +set -e + +os="$(uname -s | tr "[:upper:]" "[:lower:]")" +arch=$(uname -m) + +case $arch in +x86_64) + arch="x64" + ;; +arm64) ;; +*) + printf "%s doesn't supported by bash installer" "$os" + exit 1 + ;; +esac + +case "${os}" in +darwin) ;; +linux) ;; +*) + echo >&2 "$os is not supported" + exit 1 + ;; +esac + +curl -L -o tinymist "https://github.com/Myriad-Dreamin/tinymist/releases/latest/download/tinymist-${os}-${arch}" +chmod +x tinymist diff --git a/settings.json b/settings.json index 5898a9e5..34f3a785 100644 --- a/settings.json +++ b/settings.json @@ -1969,6 +1969,12 @@ "url": "https://github.com/nvarner/typst-lsp", "description": "Language server for Typst", "requires": [] + }, + { + "command": "tinymist", + "url": "https://github.com/Myriad-Dreamin/tinymist", + "description": "An integrated language service for Typst", + "requires": [] } ], "typst": [ @@ -1977,6 +1983,12 @@ "url": "https://github.com/nvarner/typst-lsp", "description": "Language server for Typst", "requires": [] + }, + { + "command": "tinymist", + "url": "https://github.com/Myriad-Dreamin/tinymist", + "description": "An integrated language service for Typst", + "requires": [] } ], "vala": [ diff --git a/settings/tinymist.vim b/settings/tinymist.vim new file mode 100644 index 00000000..d3a35bb1 --- /dev/null +++ b/settings/tinymist.vim @@ -0,0 +1,14 @@ +augroup vim_lsp_settings_tinymist + au! + LspRegisterServer { + \ 'name': 'tinymist', + \ 'cmd': {server_info->lsp_settings#get('tinymist', 'cmd', [lsp_settings#exec_path('tinymist')]+lsp_settings#get('tinymist', 'args', ['lsp']))}, + \ 'root_uri':{server_info->lsp_settings#get('tinymist', 'root_uri', lsp_settings#root_uri('tinymist'))}, + \ 'initialization_options': lsp_settings#get('tinymist', 'initialization_options', v:null), + \ 'allowlist': lsp_settings#get('tinymist', 'allowlist', ['typst', 'typ']), + \ 'blocklist': lsp_settings#get('tinymist', 'blocklist', []), + \ 'config': lsp_settings#get('tinymist', 'config', lsp_settings#server_config('tinymist')), + \ 'workspace_config': lsp_settings#get('tinymist', 'workspace_config', {}), + \ 'semantic_highlight': lsp_settings#get('tinymist', 'semantic_highlight', {}), + \ } +augroup END