diff options
| -rw-r--r-- | core/vimrc | 29 |
1 files changed, 16 insertions, 13 deletions
| @@ -225,26 +225,27 @@ augroup rust_detached | |||
| 225 | \ && empty(RustCrate()) && s:RustAddDetached() | 225 | \ && empty(RustCrate()) && s:RustAddDetached() |
| 226 | \ | call lsp#update_workspace_config('rust-analyzer', {'rust-analyzer': g:ra_init}) | endif | 226 | \ | call lsp#update_workspace_config('rust-analyzer', {'rust-analyzer': g:ra_init}) | endif |
| 227 | augroup END | 227 | augroup END |
| 228 | " rust-analyzer via the rustup proxy shim (portable across toolchains/machines) | 228 | " Language servers are looked up on $PATH (exepath); a server that isn't on $PATH is skipped |
| 229 | if executable(expand('~/.cargo/bin/rust-analyzer')) | 229 | " rust-analyzer: normally the rustup proxy shim (portable across toolchains/machines) |
| 230 | let s:ra = exepath('rust-analyzer') | ||
| 231 | if !empty(s:ra) | ||
| 230 | au User lsp_setup call lsp#register_server({ | 232 | au User lsp_setup call lsp#register_server({ |
| 231 | \ 'name': 'rust-analyzer', 'allowlist': ['rust'], | 233 | \ 'name': 'rust-analyzer', 'allowlist': ['rust'], |
| 232 | \ 'cmd': {server_info -> [expand('~/.cargo/bin/rust-analyzer')]}, | 234 | \ 'cmd': {server_info -> [s:ra]}, |
| 233 | \ 'root_uri': {server_info -> lsp#utils#path_to_uri(RustRoot())}, | 235 | \ 'root_uri': {server_info -> lsp#utils#path_to_uri(RustRoot())}, |
| 234 | \ 'initialization_options': g:ra_init, | 236 | \ 'initialization_options': g:ra_init, |
| 235 | \ 'workspace_config': {'rust-analyzer': g:ra_init}}) | 237 | \ 'workspace_config': {'rust-analyzer': g:ra_init}}) |
| 236 | endif | 238 | endif |
| 237 | if executable(expand('~/.local/bin/ruff')) | 239 | let s:ruff = exepath('ruff') |
| 240 | if !empty(s:ruff) | ||
| 238 | au User lsp_setup call lsp#register_server({ | 241 | au User lsp_setup call lsp#register_server({ |
| 239 | \ 'name': 'ruff', | 242 | \ 'name': 'ruff', |
| 240 | \ 'cmd': {server_info -> [expand('~/.local/bin/ruff'), 'server']}, | 243 | \ 'cmd': {server_info -> [s:ruff, 'server']}, |
| 241 | \ 'allowlist': ['python'], | 244 | \ 'allowlist': ['python'], |
| 242 | \ }) | 245 | \ }) |
| 243 | endif | 246 | endif |
| 244 | let s:uv_bin = has('macunix') && executable('/opt/homebrew/bin/uv') | 247 | let s:uv_bin = exepath('uv') |
| 245 | \ ? '/opt/homebrew/bin/uv' | 248 | if !empty(exepath('ty')) && !empty(s:uv_bin) |
| 246 | \ : expand('~/.local/bin/uv') | ||
| 247 | if executable(expand('~/.local/bin/ty')) && executable(s:uv_bin) | ||
| 248 | " Launched through `uv run` (not the raw path) so it picks up whichever | 249 | " Launched through `uv run` (not the raw path) so it picks up whichever |
| 249 | " project's .venv is active via cwd/VIRTUAL_ENV. | 250 | " project's .venv is active via cwd/VIRTUAL_ENV. |
| 250 | au User lsp_setup call lsp#register_server({ | 251 | au User lsp_setup call lsp#register_server({ |
| @@ -254,18 +255,20 @@ if executable(expand('~/.local/bin/ty')) && executable(s:uv_bin) | |||
| 254 | \ }) | 255 | \ }) |
| 255 | endif | 256 | endif |
| 256 | " tofu-ls (OpenTofu/Terraform .tf) for go-to-definition | 257 | " tofu-ls (OpenTofu/Terraform .tf) for go-to-definition |
| 257 | if executable(expand('~/.local/bin/tofu-ls')) | 258 | let s:tofu_ls = exepath('tofu-ls') |
| 259 | if !empty(s:tofu_ls) | ||
| 258 | au User lsp_setup call lsp#register_server({ | 260 | au User lsp_setup call lsp#register_server({ |
| 259 | \ 'name': 'tofu-ls', | 261 | \ 'name': 'tofu-ls', |
| 260 | \ 'cmd': {server_info -> [expand('~/.local/bin/tofu-ls'), 'serve']}, | 262 | \ 'cmd': {server_info -> [s:tofu_ls, 'serve']}, |
| 261 | \ 'allowlist': ['terraform', 'terraform-vars'], | 263 | \ 'allowlist': ['terraform', 'terraform-vars'], |
| 262 | \ }) | 264 | \ }) |
| 263 | endif | 265 | endif |
| 264 | " gopls (Go) for go-to-definition | 266 | " gopls (Go) for go-to-definition |
| 265 | if executable(expand('~/go/bin/gopls')) | 267 | let s:gopls = exepath('gopls') |
| 268 | if !empty(s:gopls) | ||
| 266 | au User lsp_setup call lsp#register_server({ | 269 | au User lsp_setup call lsp#register_server({ |
| 267 | \ 'name': 'gopls', | 270 | \ 'name': 'gopls', |
| 268 | \ 'cmd': {server_info -> [expand('~/go/bin/gopls')]}, | 271 | \ 'cmd': {server_info -> [s:gopls]}, |
| 269 | \ 'allowlist': ['go'], | 272 | \ 'allowlist': ['go'], |
| 270 | \ 'root_uri': {server_info -> lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'go.mod'))}, | 273 | \ 'root_uri': {server_info -> lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'go.mod'))}, |
| 271 | \ }) | 274 | \ }) |
