From 381dd82f9a853d97c11b1aa1ddeed422d4d5758b Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Fri, 31 Jan 2020 12:49:24 +0900 Subject: Add r-languageserver --- installer/install-r-languageserver.sh | 13 +++++++++++++ settings.json | 8 ++++++++ settings/r-languageserver.vim | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100755 installer/install-r-languageserver.sh create mode 100644 settings/r-languageserver.vim diff --git a/installer/install-r-languageserver.sh b/installer/install-r-languageserver.sh new file mode 100755 index 0000000..eeaa676 --- /dev/null +++ b/installer/install-r-languageserver.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + +R --slave -e 'install.packages("languageserver")' + +cat <r-languageserver +#!/usr/bin/env bash + +R --slave -e 'languageserver::run()' +EOF + +chmod +x r-languageserver diff --git a/settings.json b/settings.json index c7163ce..b99e94a 100644 --- a/settings.json +++ b/settings.json @@ -344,6 +344,14 @@ ] } ], + "r": [ + { + "command": "r-languageserver", + "requires": [ + "R" + ] + } + ], "reason": [ { "command": "reason-language-server", diff --git a/settings/r-languageserver.vim b/settings/r-languageserver.vim new file mode 100644 index 0000000..aace440 --- /dev/null +++ b/settings/r-languageserver.vim @@ -0,0 +1,14 @@ +augroup vimlsp_settings_r_languageserver + au! + LspRegisterServer { + \ 'name': 'r-languageserver', + \ 'cmd': {server_info->lsp_settings#get('r-languageserver', 'cmd', ['R', '--slave', '-e', 'languageserver::run()'])}, + \ 'root_uri':{server_info->lsp_settings#get('r-languageserver', 'root_uri', lsp_settings#root_uri(g:lsp_settings_root_markers))}, + \ 'initialization_options': lsp_settings#get('r-languageserver', 'initialization_options', v:null), + \ 'whitelist': lsp_settings#get('r-languageserver', 'whitelist', ['r']), + \ 'blacklist': lsp_settings#get('r-languageserver', 'blacklist', []), + \ 'config': lsp_settings#get('r-languageserver', 'config', {}), + \ 'workspace_config': lsp_settings#get('r-languageserver', 'workspace_config', {}), + \ } +augroup END + -- cgit v1.2.3-54-g00ecf