Add solargraph.yml file as root path search file.

Solargraph allows to set configuration options by creating a
.solargraph.yml file at the root of the project using it. Therfore this
file is a good canditate for finding ruby projects root paths.

Initial discussion:
  https://github.com/w0rp/ale/issues/1874#issuecomment-418316168
This commit is contained in:
Horacio Sanson 2018-09-04 21:40:35 +09:00
parent 8f2e1c393f
commit 044c762c85
4 changed files with 8 additions and 1 deletions

View file

@ -29,7 +29,7 @@ function! ale#ruby#FindProjectRoot(buffer) abort
return l:dir return l:dir
endif endif
for l:name in ['Rakefile', 'Gemfile'] for l:name in ['.solargraph.yml', 'Rakefile', 'Gemfile']
let l:dir = fnamemodify( let l:dir = fnamemodify(
\ ale#path#FindNearestFile(a:buffer, l:name), \ ale#path#FindNearestFile(a:buffer, l:name),
\ ':h' \ ':h'

View file

@ -27,3 +27,10 @@ Execute(should set solargraph for ruby app2):
AssertLSPOptions {} AssertLSPOptions {}
AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app2') AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app2')
AssertLSPAddress '127.0.0.1:7658' AssertLSPAddress '127.0.0.1:7658'
Execute(should set solargraph for ruby app3):
call ale#test#SetFilename('../ruby_fixtures/valid_ruby_app3/lib/file.rb')
AssertLSPLanguage 'ruby'
AssertLSPOptions {}
AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app3')
AssertLSPAddress '127.0.0.1:7658'