summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <horacio@allm.net>2018-09-04 21:40:35 +0900
committerHoracio Sanson <horacio@allm.net>2018-09-05 07:12:04 +0900
commit044c762c85a8a1b79dc2728fad4c593195293303 (patch)
tree5f154ffb84f43a502945421b51e44ab49d011b8c
parent8f2e1c393f74326979e1c74af8dc9b6ca8004778 (diff)
downloadale-044c762c85a8a1b79dc2728fad4c593195293303.zip
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
-rw-r--r--autoload/ale/ruby.vim2
-rw-r--r--test/command_callback/test_ruby_solargraph.vader7
-rw-r--r--test/ruby_fixtures/valid_ruby_app3/.solargraph.yml0
-rw-r--r--test/ruby_fixtures/valid_ruby_app3/lib/file.rb0
4 files changed, 8 insertions, 1 deletions
diff --git a/autoload/ale/ruby.vim b/autoload/ale/ruby.vim
index f0d84296..5f0aa50d 100644
--- a/autoload/ale/ruby.vim
+++ b/autoload/ale/ruby.vim
@@ -29,7 +29,7 @@ function! ale#ruby#FindProjectRoot(buffer) abort
return l:dir
endif
- for l:name in ['Rakefile', 'Gemfile']
+ for l:name in ['.solargraph.yml', 'Rakefile', 'Gemfile']
let l:dir = fnamemodify(
\ ale#path#FindNearestFile(a:buffer, l:name),
\ ':h'
diff --git a/test/command_callback/test_ruby_solargraph.vader b/test/command_callback/test_ruby_solargraph.vader
index a27cb62d..b9dd46d8 100644
--- a/test/command_callback/test_ruby_solargraph.vader
+++ b/test/command_callback/test_ruby_solargraph.vader
@@ -27,3 +27,10 @@ Execute(should set solargraph for ruby app2):
AssertLSPOptions {}
AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app2')
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'
diff --git a/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml b/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app3/.solargraph.yml
diff --git a/test/ruby_fixtures/valid_ruby_app3/lib/file.rb b/test/ruby_fixtures/valid_ruby_app3/lib/file.rb
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app3/lib/file.rb