summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/vimrc29
1 files changed, 16 insertions, 13 deletions
diff --git a/core/vimrc b/core/vimrc
index 8c43954..4ae28ad 100644
--- a/core/vimrc
+++ b/core/vimrc
@@ -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
227augroup END 227augroup 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
229if executable(expand('~/.cargo/bin/rust-analyzer')) 229" rust-analyzer: normally the rustup proxy shim (portable across toolchains/machines)
230let s:ra = exepath('rust-analyzer')
231if !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}})
236endif 238endif
237if executable(expand('~/.local/bin/ruff')) 239let s:ruff = exepath('ruff')
240if !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 \ })
243endif 246endif
244let s:uv_bin = has('macunix') && executable('/opt/homebrew/bin/uv') 247let s:uv_bin = exepath('uv')
245 \ ? '/opt/homebrew/bin/uv' 248if !empty(exepath('ty')) && !empty(s:uv_bin)
246 \ : expand('~/.local/bin/uv')
247if 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 \ })
255endif 256endif
256" tofu-ls (OpenTofu/Terraform .tf) for go-to-definition 257" tofu-ls (OpenTofu/Terraform .tf) for go-to-definition
257if executable(expand('~/.local/bin/tofu-ls')) 258let s:tofu_ls = exepath('tofu-ls')
259if !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 \ })
263endif 265endif
264" gopls (Go) for go-to-definition 266" gopls (Go) for go-to-definition
265if executable(expand('~/go/bin/gopls')) 267let s:gopls = exepath('gopls')
268if !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 \ })