From 6198d0512be28fc2eeb6dfa7bf2a18f8c7f31ee3 Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Tue, 18 Feb 2020 22:00:35 +0900 Subject: rust-analyzer: add rust-analyzer I think it's better to keep ra_lsp_server for a while as a user transition period, so I add rust-analyzer instead of rename. --- installer/install-rust-analyzer.cmd | 5 +++++ installer/install-rust-analyzer.sh | 20 ++++++++++++++++++++ settings.json | 4 ++++ settings/rust-analyzer.vim | 13 +++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 installer/install-rust-analyzer.cmd create mode 100755 installer/install-rust-analyzer.sh create mode 100644 settings/rust-analyzer.vim diff --git a/installer/install-rust-analyzer.cmd b/installer/install-rust-analyzer.cmd new file mode 100644 index 0000000..f204545 --- /dev/null +++ b/installer/install-rust-analyzer.cmd @@ -0,0 +1,5 @@ +@echo off + +curl -L -o rust-analyzer-windows.exe "https://github.com/rust-analyzer/rust-analyzer/releases/download/2020-02-18/rust-analyzer-windows.exe" + +move rust-analyzer-windows.exe rust-analyzer.exe diff --git a/installer/install-rust-analyzer.sh b/installer/install-rust-analyzer.sh new file mode 100755 index 0000000..fc0afb1 --- /dev/null +++ b/installer/install-rust-analyzer.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +os=$(uname -s | tr "[:upper:]" "[:lower:]") + +case $os in +linux) + platform="linux" + ;; +darwin) + platform="mac" + ;; +esac + +version="2020-02-18" +curl -L -o ra_lsp_server-$platform "https://github.com/rust-analyzer/rust-analyzer/releases/download/$version/rust-analyzer-$platform" + +mv rust-analyzer-$platform rust-analyzer +chmod +x rust-analyzer diff --git a/settings.json b/settings.json index 7847d2b..7d0c068 100644 --- a/settings.json +++ b/settings.json @@ -466,6 +466,10 @@ "command": "rls", "requires": [] }, + { + "command": "rust-analyzer", + "requires": [] + }, { "command": "ra_lsp_server", "requires": [] diff --git a/settings/rust-analyzer.vim b/settings/rust-analyzer.vim new file mode 100644 index 0000000..d07fc1c --- /dev/null +++ b/settings/rust-analyzer.vim @@ -0,0 +1,13 @@ +augroup vimlsp_settings_rust-analyzer + au! + LspRegisterServer { + \ 'name': 'rust-analyzer', + \ 'cmd': {server_info->lsp_settings#get('rust-analyzer', 'cmd', [lsp_settings#exec_path('rust-analyzer')])}, + \ 'root_uri':{server_info->lsp_settings#get('rust-analyzer', 'root_uri', lsp_settings#root_uri(['Cargo.toml']))}, + \ 'initialization_options': lsp_settings#get('rust-analyzer', 'initialization_options', v:null), + \ 'whitelist': lsp_settings#get('rust-analyzer', 'whitelist', ['rust']), + \ 'blacklist': lsp_settings#get('rust-analyzer', 'blacklist', []), + \ 'config': lsp_settings#get('rust-analyzer', 'config', lsp_settings#server_config('rust-analyzer')), + \ 'workspace_config': lsp_settings#get('rust-analyzer', 'workspace_config', {}), + \ } +augroup END -- cgit v1.2.3-54-g00ecf