step0、参考:language servers used with YCM
step1、安装依赖
安装时 | RubyToolSet、bundler |
运行时 | RubyToolSet |
step2、创建~/.lsp/ruby-language-server
目录
mkdir -p ~/.lsp/ruby-language-server
step3、进入~/.lsp/ruby-language-server
目录
cd ~/.lsp/ruby-language-server
step4、使用bundle命令创建Gemfile
bundle init
step5、将Gemfile
修改为如下
# frozen_string_literal: true
source "https://gems.ruby-china.com/"
gem "solargraph"
step6、使用bundle命令安装依赖
bundle install --path=vendor/bundle --binstubs
step7、在~/.vimrc
中加入如下的配置
let g:ycm_language_server = [
\{ 'name': 'ruby',
\ 'filetypes': [ 'ruby' ],
\ 'cmdline': [ expand( '$HOME/.lsp/ruby-language-server/bin/solargraph' ), 'stdio' ],
\}
]