Add starpls server (Starlark LSP)

"starpls is a language server for Starlark, the configuration language
used by Bazel and Buck2." [1]

[1]: https://github.com/withered-magic/starpls
This commit is contained in:
Mark Korondi
2024-08-20 15:28:42 +02:00
committed by mattn
parent 65749446c8
commit ac7a1dc60b
5 changed files with 68 additions and 0 deletions

View File

@@ -171,6 +171,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d
| SQL | sql-language-server | Yes | Yes |
| SQL | sqls | Yes | Yes |
| SQL | plpgsql-server | UNIX Only | Yes |
| Starlark | starpls | Yes | Yes |
| Scala | Metals | Yes | Yes |
| Svelte | svelte-language-server | Yes | Yes |
| Svelte | tailwindcss-intellisense | Yes | Yes |

View File

@@ -0,0 +1,3 @@
@echo off
curl -L -o "starpls.exe" "https://github.com/withered-magic/starpls/releases/latest/download/starpls-windows-amd64.exe"

41
installer/install-starpls.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
set -e
os=$(uname -s | tr "[:upper:]" "[:lower:]")
arch="$(uname -m)"
case $os in
linux)
if [ "$arch" = "x86_64" ]; then
platform="linux-amd64"
else
echo "unknown architecture: $arch"
exit 1
fi
;;
darwin)
if [ "$arch" = "aarch64" ] || [ "$arch" = "arm64" ]; then
platform="darwin-arm64"
else
echo "unknown architecture: $arch"
exit 1
fi
;;
mingw64_nt*)
if [ "$arch" = "x86_64" ]; then
platform="windows-amd64.exe"
else
echo "unknown architecture: $arch"
exit 1
fi
;;
*)
echo "unknow platform: $os"
exit 1
;;
esac
curl -L -o "starpls" "https://github.com/withered-magic/starpls/releases/latest/download/starpls-$platform"
chmod +x starpls

View File

@@ -66,6 +66,14 @@
]
}
],
"bzl": [
{
"command": "starpls",
"url": "https://github.com/withered-magic/starpls",
"description": "An LSP implementation for Starlark, the configuration language used by Bazel and Buck2.",
"requires": []
}
],
"c": [
{
"command": "clangd",

15
settings/starpls.vim Normal file
View File

@@ -0,0 +1,15 @@
augroup vim_lsp_settings_starpls
au!
LspRegisterServer {
\ 'name': 'starpls',
\ 'cmd': {server_info->lsp_settings#get('starpls', 'cmd', [lsp_settings#exec_path('starpls')]+lsp_settings#get('starpls', 'args', []))},
\ 'root_uri':{server_info->lsp_settings#get('starpls', 'root_uri', lsp_settings#root_uri('starpls'))},
\ 'initialization_options': lsp_settings#get('starpls', 'initialization_options', {}),
\ 'allowlist': lsp_settings#get('starpls', 'allowlist', ['bzl', 'starlark']),
\ 'blocklist': lsp_settings#get('starpls', 'blocklist', []),
\ 'config': lsp_settings#get('starpls', 'config', lsp_settings#server_config('starpls')),
\ 'workspace_config': lsp_settings#get('starpls', 'workspace_config', {}),
\ 'semantic_highlight': lsp_settings#get('starpls', 'semantic_highlight', {}),
\ }
augroup END