Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add typst-lsp #715

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d
| TypeScript | deno | Yes | Yes |
| TypeScript | rome | Yes | Yes |
| TypeScript | eslint-language-server | Yes | Yes |
| Typst | typst-lsp | Yes | Yes |
| Vim | vim-language-server | Yes | Yes |
| Vala | vala-language-server | No | No |
| Veryl | veryl-ls | Yes | Yes |
Expand Down
4 changes: 4 additions & 0 deletions installer/install-typst-lsp.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

setlocal
curl -L -o typst-lsp-x86_64-pc-windows-msvc.exe "https://github.com/nvarner/typst-lsp/releases/latest/download/typst-lsp-x86_64-pc-windows-msvc.exe"
34 changes: 34 additions & 0 deletions installer/install-typst-lsp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

set -e
#set -o pipefail

os="$(uname -s | tr "[:upper:]" "[:lower:]")"
arch=$(uname -m)

case $arch in
x86_64) ;;
arm64)
arch="aarch64"
;;
*)
printf "%s doesn't supported by bash installer" "$os"
exit 1
;;
esac

case "${os}" in
darwin)
url="https://github.com/nvarner/typst-lsp/releases/latest/download/typst-lsp-${arch}-apple-darwin"
;;
linux)
url="https://github.com/nvarner/typst-lsp/releases/latest/download/typst-lsp-${arch}-unknown-linux-gnu"
;;
*)
echo >&2 "$os is not supported"
exit 1
;;
esac

curl -L -o typst-lsp "$url"
chmod +x typst-lsp
16 changes: 16 additions & 0 deletions settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,22 @@
"requires": []
}
],
"typ": [
{
"command": "typst-lsp",
"url": "https://github.com/nvarner/typst-lsp",
"description": "Language server for Typst",
"requires": []
}
],
"typst": [
{
"command": "typst-lsp",
"url": "https://github.com/nvarner/typst-lsp",
"description": "Language server for Typst",
"requires": []
}
],
"vala": [
{
"command": "vala-language-server",
Expand Down
14 changes: 14 additions & 0 deletions settings/typst-lsp.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
augroup vim_lsp_settings_typst_lsp
au!
LspRegisterServer {
\ 'name': 'typst-lsp',
\ 'cmd': {server_info->lsp_settings#get('typst-lsp', 'cmd', [lsp_settings#exec_path('typst-lsp')]+lsp_settings#get('typst-lsp', 'args', []))},
\ 'root_uri':{server_info->lsp_settings#get('typst-lsp', 'root_uri', lsp_settings#root_uri('typst-lsp'))},
\ 'initialization_options': lsp_settings#get('typst-lsp', 'initialization_options', v:null),
\ 'allowlist': lsp_settings#get('typst-lsp', 'allowlist', ['typst', 'typ']),
\ 'blocklist': lsp_settings#get('typst-lsp', 'blocklist', []),
\ 'config': lsp_settings#get('typst-lsp', 'config', lsp_settings#server_config('typst-lsp')),
\ 'workspace_config': lsp_settings#get('typst-lsp', 'workspace_config', {}),
\ 'semantic_highlight': lsp_settings#get('typst-lsp', 'semantic_highlight', {}),
\ }
augroup END
Loading