YouCompleteMe with Ruby

step0、参考:language servers used with YCM

step1、安装依赖

安装时RubyToolSetbundler
运行时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' ],
    \}
]