summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--ale_linters/java/javalsp.vim22
-rw-r--r--ale_linters/ruby/solargraph.vim19
-rw-r--r--autoload/ale/assert.vim13
-rw-r--r--autoload/ale/definition.vim2
-rw-r--r--autoload/ale/fix/registry.vim5
-rw-r--r--autoload/ale/fixers/ocamlformat.vim18
-rw-r--r--autoload/ale/java.vim20
-rw-r--r--autoload/ale/lsp.vim1
-rw-r--r--autoload/ale/ruby.vim22
-rw-r--r--doc/ale-development.txt1
-rw-r--r--doc/ale-java.txt23
-rw-r--r--doc/ale-ocaml.txt17
-rw-r--r--doc/ale-ruby.txt18
-rw-r--r--doc/ale.txt9
-rw-r--r--test/command_callback/test_javalsp_command_callback.vader10
-rw-r--r--test/command_callback/test_ruby_solargraph.vader29
-rw-r--r--test/fixers/test_ocamlformat_fixer_callback.vader40
-rw-r--r--test/ocaml-test-files/testfile.ml0
-rw-r--r--test/ruby_fixtures/valid_ruby_app1/Rakefile0
-rw-r--r--test/ruby_fixtures/valid_ruby_app1/lib/file.rb0
-rw-r--r--test/ruby_fixtures/valid_ruby_app2/Gemfile0
-rw-r--r--test/ruby_fixtures/valid_ruby_app2/lib/file.rb0
-rw-r--r--test/test_go_to_definition.vader8
24 files changed, 272 insertions, 11 deletions
diff --git a/README.md b/README.md
index 4fd109ff..e8108733 100644
--- a/README.md
+++ b/README.md
@@ -132,7 +132,7 @@ formatting.
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [cabal-ghc](https://www.haskell.org/cabal/), [stylish-haskell](https://github.com/jaspervdj/stylish-haskell), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt), [hie](https://github.com/haskell/haskell-ide-engine) |
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
| Idris | [idris](http://www.idris-lang.org/) |
-| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/) |
+| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/), [javalsp](https://github.com/georgewfraser/vscode-javac) |
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint-cli), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
| JSON | [fixjson](https://github.com/rhysd/fixjson), [jsonlint](http://zaa.ch/jsonlint/), [jq](https://stedolan.github.io/jq/), [prettier](https://github.com/prettier/prettier) |
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !!, [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions |
@@ -151,7 +151,7 @@ formatting.
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
| Objective-C | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html) |
| Objective-C++ | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html) |
-| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server) |
+| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) |
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic), [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy) |
| PHP | [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer), [php-cs-fixer](http://cs.sensiolabs.org/) |
| PO | [alex](https://github.com/wooorm/alex) !!, [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
@@ -167,7 +167,7 @@ formatting.
| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| Re:VIEW | [redpen](http://redpen.cc/) |
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
-| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo) |
+| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo), [solargraph]([solargraph](https://solargraph.org) |
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
diff --git a/ale_linters/java/javalsp.vim b/ale_linters/java/javalsp.vim
new file mode 100644
index 00000000..f335e83c
--- /dev/null
+++ b/ale_linters/java/javalsp.vim
@@ -0,0 +1,22 @@
+" Author: Horacio Sanson <https://github.com/hsanson>
+" Description: Support for the Java language server https://github.com/georgewfraser/vscode-javac
+
+call ale#Set('java_javalsp_jar', 'javacs.jar')
+
+function! ale_linters#java#javalsp#Executable(buffer) abort
+ return 'java'
+endfunction
+
+function! ale_linters#java#javalsp#Command(buffer) abort
+ let l:jar = ale#Var(a:buffer, 'java_javalsp_jar')
+ return ale#Escape('java -cp ' . l:jar . ' -Xverify:none org.javacs.Main')
+endfunction
+
+call ale#linter#Define('java', {
+\ 'name': 'javalsp',
+\ 'lsp': 'stdio',
+\ 'executable_callback': 'ale_linters#java#javalsp#Executable',
+\ 'command_callback': 'ale_linters#java#javalsp#Command',
+\ 'language': 'java',
+\ 'project_root_callback': 'ale#java#FindProjectRoot',
+\})
diff --git a/ale_linters/ruby/solargraph.vim b/ale_linters/ruby/solargraph.vim
new file mode 100644
index 00000000..a53bcaa3
--- /dev/null
+++ b/ale_linters/ruby/solargraph.vim
@@ -0,0 +1,19 @@
+" Author: Horacio Sanson - https://github.com/hsanson
+" Description: Solargraph Language Server https://solargraph.org/
+
+call ale#Set('ruby_solargraph_host', '127.0.0.1')
+call ale#Set('ruby_solargraph_port', '7658')
+
+function! ale_linters#ruby#solargraph#GetAddress(buffer) abort
+ let l:host = ale#Var(a:buffer, 'ruby_solargraph_host')
+ let l:port = ale#Var(a:buffer, 'ruby_solargraph_port')
+ return l:host . ':' . l:port
+endfunction
+
+call ale#linter#Define('ruby', {
+\ 'name': 'solargraph',
+\ 'lsp': 'socket',
+\ 'address_callback': 'ale_linters#ruby#solargraph#GetAddress',
+\ 'language': 'ruby',
+\ 'project_root_callback': 'ale#ruby#FindProjectRoot'
+\})
diff --git a/autoload/ale/assert.vim b/autoload/ale/assert.vim
index 87798520..a1bfd0b7 100644
--- a/autoload/ale/assert.vim
+++ b/autoload/ale/assert.vim
@@ -101,6 +101,14 @@ function! ale#assert#LSPProject(expected_root) abort
AssertEqual a:expected_root, l:root
endfunction
+function! ale#assert#LSPAddress(expected_address) abort
+ let l:buffer = bufnr('')
+ let l:linter = s:GetLinter()
+ let l:address = ale#util#GetFunction(l:linter.address_callback)(l:buffer)
+
+ AssertEqual a:expected_address, l:address
+endfunction
+
" A dummy function for making sure this module is loaded.
function! ale#assert#SetUpLinterTest(filetype, name) abort
" Set up a marker so ALE doesn't create real random temporary filenames.
@@ -141,6 +149,7 @@ function! ale#assert#SetUpLinterTest(filetype, name) abort
command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions(<args>)
command! -nargs=+ AssertLSPLanguage :call ale#assert#LSPLanguage(<args>)
command! -nargs=+ AssertLSPProject :call ale#assert#LSPProject(<args>)
+ command! -nargs=+ AssertLSPAddress :call ale#assert#LSPAddress(<args>)
endfunction
function! ale#assert#TearDownLinterTest() abort
@@ -171,6 +180,10 @@ function! ale#assert#TearDownLinterTest() abort
delcommand AssertLSPProject
endif
+ if exists(':AssertLSPAddress')
+ delcommand AssertLSPAddress
+ endif
+
if exists('g:dir')
call ale#test#RestoreDirectory()
endif
diff --git a/autoload/ale/definition.vim b/autoload/ale/definition.vim
index e68d279d..984a4f9d 100644
--- a/autoload/ale/definition.vim
+++ b/autoload/ale/definition.vim
@@ -49,7 +49,7 @@ function! ale#definition#HandleLSPResponse(conn_id, response) abort
for l:item in l:result
let l:filename = ale#path#FromURI(l:item.uri)
let l:line = l:item.range.start.line + 1
- let l:column = l:item.range.start.character
+ let l:column = l:item.range.start.character + 1
call ale#util#Open(l:filename, l:line, l:column, l:options)
break
diff --git a/autoload/ale/fix/registry.vim b/autoload/ale/fix/registry.vim
index 7e9900b1..1ca54a86 100644
--- a/autoload/ale/fix/registry.vim
+++ b/autoload/ale/fix/registry.vim
@@ -180,6 +180,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['haskell'],
\ 'description': 'Refactor Haskell files with stylish-haskell.',
\ },
+\ 'ocamlformat': {
+\ 'function': 'ale#fixers#ocamlformat#Fix',
+\ 'suggested_filetypes': ['ocaml'],
+\ 'description': 'Fix OCaml files with ocamlformat.',
+\ },
\ 'refmt': {
\ 'function': 'ale#fixers#refmt#Fix',
\ 'suggested_filetypes': ['reason'],
diff --git a/autoload/ale/fixers/ocamlformat.vim b/autoload/ale/fixers/ocamlformat.vim
new file mode 100644
index 00000000..fac142aa
--- /dev/null
+++ b/autoload/ale/fixers/ocamlformat.vim
@@ -0,0 +1,18 @@
+" Author: Stephen Lumenta <@sbl>
+" Description: Integration of ocamlformat with ALE.
+
+call ale#Set('ocaml_ocamlformat_executable', 'ocamlformat')
+call ale#Set('ocaml_ocamlformat_options', '')
+
+function! ale#fixers#ocamlformat#Fix(buffer) abort
+ let l:executable = ale#Var(a:buffer, 'ocaml_ocamlformat_executable')
+ let l:options = ale#Var(a:buffer, 'ocaml_ocamlformat_options')
+
+ return {
+ \ 'command': ale#Escape(l:executable)
+ \ . (empty(l:options) ? '' : ' ' . l:options)
+ \ . ' --inplace'
+ \ . ' %t',
+ \ 'read_temporary_file': 1,
+ \}
+endfunction
diff --git a/autoload/ale/java.vim b/autoload/ale/java.vim
new file mode 100644
index 00000000..b7fd10bd
--- /dev/null
+++ b/autoload/ale/java.vim
@@ -0,0 +1,20 @@
+" Author: Horacio Sanson https://github.com/hsanson
+" Description: Functions for integrating with Java tools
+
+" Find the nearest dir contining a gradle or pom file and asume it
+" the root of a java app.
+function! ale#java#FindProjectRoot(buffer) abort
+ let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer)
+
+ if !empty(l:gradle_root)
+ return l:gradle_root
+ endif
+
+ let l:maven_pom_file = ale#path#FindNearestFile(a:buffer, 'pom.xml')
+
+ if !empty(l:maven_pom_file)
+ return fnamemodify(l:maven_pom_file, ':h')
+ endif
+
+ return ''
+endfunction
diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim
index 7f99422a..dae45e70 100644
--- a/autoload/ale/lsp.vim
+++ b/autoload/ale/lsp.vim
@@ -24,6 +24,7 @@ function! ale#lsp#Register(executable_or_address, project, init_options) abort
" capabilities_queue: The list of callbacks to call with capabilities.
" capabilities: Features the server supports.
let s:connections[l:conn_id] = {
+ \ 'id': l:conn_id,
\ 'is_tsserver': 0,
\ 'data': '',
\ 'root': a:project,
diff --git a/autoload/ale/ruby.vim b/autoload/ale/ruby.vim
index b981ded6..f0d84296 100644
--- a/autoload/ale/ruby.vim
+++ b/autoload/ale/ruby.vim
@@ -20,3 +20,25 @@ function! ale#ruby#FindRailsRoot(buffer) abort
return ''
endfunction
+
+" Find the nearest dir containing a potential ruby project.
+function! ale#ruby#FindProjectRoot(buffer) abort
+ let l:dir = ale#ruby#FindRailsRoot(a:buffer)
+
+ if isdirectory(l:dir)
+ return l:dir
+ endif
+
+ for l:name in ['Rakefile', 'Gemfile']
+ let l:dir = fnamemodify(
+ \ ale#path#FindNearestFile(a:buffer, l:name),
+ \ ':h'
+ \)
+
+ if l:dir isnot# '.' && isdirectory(l:dir)
+ return l:dir
+ endif
+ endfor
+
+ return ''
+endfunction
diff --git a/doc/ale-development.txt b/doc/ale-development.txt
index d83c98f2..ac72d615 100644
--- a/doc/ale-development.txt
+++ b/doc/ale-development.txt
@@ -307,6 +307,7 @@ given the above setup are as follows.
`AssertLSPLanguage language` - Check the language given to an LSP server.
`AssertLSPOptions options_dict` - Check the options given to an LSP server.
`AssertLSPProject project_root` - Check the root given to an LSP server.
+`AssertLSPAddress address` - Check the address to an LSP server.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-java.txt b/doc/ale-java.txt
index 4481e823..827a268c 100644
--- a/doc/ale-java.txt
+++ b/doc/ale-java.txt
@@ -76,4 +76,27 @@ g:ale_java_pmd_options *g:ale_java_pmd_options*
===============================================================================
+javalsp *ale-java-javalsp*
+
+To enable Java LSP linter you need to download and build the vscode-javac
+language server from https://github.com/georgewfraser/vscode-javac. Simply
+download the source code and then build the plugin using maven:
+
+ mvn package
+
+This generates a out/fat-jar.jar file that contains the language server. To
+let ALE use this language server you need to set the g:ale_java_javalsp_jar
+variable to the absolute path of this jar file.
+
+g:ale_java_javalsp_jar *g:ale_java_javalsp_jar*
+ *b:ale_java_javalsp_jar*
+
+ Type: String
+ Default: 'fat-jar.jar
+
+ Path to the location of the vscode-javac language server plugin.
+ and -d. They are added automatically.
+
+
+===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-ocaml.txt b/doc/ale-ocaml.txt
index a7ef8d29..adf17716 100644
--- a/doc/ale-ocaml.txt
+++ b/doc/ale-ocaml.txt
@@ -34,4 +34,21 @@ g:ale_ocaml_ols_use_global *g:ale_ocaml_ols_use_global*
executable. See also |ale-integrations-local-executables|.
===============================================================================
+ocamlformat *ale-ocaml-ocamlformat*
+
+g:ale_ocaml_ocamlformat_executable *g:ale_ocaml_ocamlformat_executable*
+ *b:ale_ocaml_ocamlformat_executable*
+ Type: |String|
+ Default: `'ocamlformat'`
+
+ This variable can be set to pass the path of the ocamlformat fixer.
+
+g:ale_ocaml_ocamlformat_options *g:ale_ocaml_ocamlformat_options*
+ *b:ale_ocaml_ocamlformat_options*
+ Type: |String|
+ Default: `''`
+
+ This variable can be set to pass additional options to the ocamlformat fixer.
+
+===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale-ruby.txt b/doc/ale-ruby.txt
index 85a3e137..ec7b07cf 100644
--- a/doc/ale-ruby.txt
+++ b/doc/ale-ruby.txt
@@ -99,4 +99,22 @@ g:ale_ruby_rufo_executable *g:ale_ruby_rufo_executable*
===============================================================================
+solargraph *ale-ruby-solargraph*
+
+g:ale_ruby_solargraph_host *g:ale_ruby_solargraph_host*
+ *b:ale_ruby_solargraph_host*
+ Type: String
+ Default: `'127.0.0.1'`
+
+ The host/ip where the solargraph language server is running.
+
+g:ale_ruby_solargraph_port *g:ale_ruby_solargraph_port*
+ *b:ale_ruby_solargraph_port*
+ Type: String
+ Default: `'7658'`
+
+ The listening port where the solargraph language server is running.
+
+
+===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
diff --git a/doc/ale.txt b/doc/ale.txt
index 8e38f92a..29f74e1a 100644
--- a/doc/ale.txt
+++ b/doc/ale.txt
@@ -127,6 +127,7 @@ CONTENTS *ale-contents*
javac...............................|ale-java-javac|
google-java-format..................|ale-java-google-java-format|
pmd.................................|ale-java-pmd|
+ javalsp.............................|ale-java-javalsp|
javascript............................|ale-javascript-options|
eslint..............................|ale-javascript-eslint|
flow................................|ale-javascript-flow|
@@ -179,6 +180,7 @@ CONTENTS *ale-contents*
ocaml.................................|ale-ocaml-options|
merlin..............................|ale-ocaml-merlin|
ols.................................|ale-ocaml-ols|
+ ocamlformat.........................|ale-ocaml-ocamlformat|
perl..................................|ale-perl-options|
perl................................|ale-perl-perl|
perlcritic..........................|ale-perl-perlcritic|
@@ -237,6 +239,7 @@ CONTENTS *ale-contents*
rubocop.............................|ale-ruby-rubocop|
ruby................................|ale-ruby-ruby|
rufo................................|ale-ruby-rufo|
+ solargraph..........................|ale-ruby-solargraph|
rust..................................|ale-rust-options|
cargo...............................|ale-rust-cargo|
rls.................................|ale-rust-rls|
@@ -387,7 +390,7 @@ Notes:
* Haskell: `brittany`, `ghc`, `cabal-ghc`, `stylish-haskell`, `stack-ghc`, `stack-build`!!, `ghc-mod`, `stack-ghc-mod`, `hlint`, `hdevtools`, `hfmt`, `hie`
* HTML: `alex`!!, `HTMLHint`, `proselint`, `tidy`, `write-good`
* Idris: `idris`
-* Java: `checkstyle`, `javac`, `google-java-format`, `PMD`
+* Java: `checkstyle`, `javac`, `google-java-format`, `PMD`, `javalsp`
* JavaScript: `eslint`, `flow`, `jscs`, `jshint`, `prettier`, `prettier-eslint`, `prettier-standard`, `standard`, `xo`
* JSON: `fixjson`, `jsonlint`, `jq`, `prettier`
* Kotlin: `kotlinc`!!, `ktlint`!!, `languageserver`
@@ -406,7 +409,7 @@ Notes:
* nroff: `alex`!!, `proselint`, `write-good`
* Objective-C: `clang`, `clangd`
* Objective-C++: `clang`, `clangd`
-* OCaml: `merlin` (see |ale-ocaml-merlin|), `ols`
+* OCaml: `merlin` (see |ale-ocaml-merlin|), `ols`, `ocamlformat`
* Perl: `perl -c`, `perl-critic`, `perltidy`
* PHP: `langserver`, `phan`, `php -l`, `phpcs`, `phpmd`, `phpstan`, `phpcbf`, `php-cs-fixer`
* PO: `alex`!!, `msgfmt`, `proselint`, `write-good`
@@ -422,7 +425,7 @@ Notes:
* reStructuredText: `alex`!!, `proselint`, `redpen`, `rstcheck`, `vale`, `write-good`
* Re:VIEW: `redpen`
* RPM spec: `rpmlint`
-* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`
+* Ruby: `brakeman`, `rails_best_practices`!!, `reek`, `rubocop`, `ruby`, `rufo`, `solargraph`
* Rust: `cargo`!!, `rls`, `rustc` (see |ale-integration-rust|), `rustfmt`
* SASS: `sass-lint`, `stylelint`
* SCSS: `prettier`, `sass-lint`, `scss-lint`, `stylelint`
diff --git a/test/command_callback/test_javalsp_command_callback.vader b/test/command_callback/test_javalsp_command_callback.vader
new file mode 100644
index 00000000..1fbfddfb
--- /dev/null
+++ b/test/command_callback/test_javalsp_command_callback.vader
@@ -0,0 +1,10 @@
+
+Before:
+ call ale#assert#SetUpLinterTest('java', 'javalsp')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The javalsp callback should return the correct default value):
+ AssertLinter 'java', ale#Escape('java -cp javacs.jar -Xverify:none org.javacs.Main')
+
diff --git a/test/command_callback/test_ruby_solargraph.vader b/test/command_callback/test_ruby_solargraph.vader
new file mode 100644
index 00000000..a27cb62d
--- /dev/null
+++ b/test/command_callback/test_ruby_solargraph.vader
@@ -0,0 +1,29 @@
+" Author: Horacio Sanson <https://github.com/hsanson>
+" Description: Tests for solargraph lsp linter.
+
+Before:
+ call ale#assert#SetUpLinterTest('ruby', 'solargraph')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(should set solargraph for rails app):
+ call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/app/models/thing.rb')
+ AssertLSPLanguage 'ruby'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_rails_app')
+ AssertLSPAddress '127.0.0.1:7658'
+
+Execute(should set solargraph for ruby app1):
+ call ale#test#SetFilename('../ruby_fixtures/valid_ruby_app1/lib/file.rb')
+ AssertLSPLanguage 'ruby'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app1')
+ AssertLSPAddress '127.0.0.1:7658'
+
+Execute(should set solargraph for ruby app2):
+ call ale#test#SetFilename('../ruby_fixtures/valid_ruby_app2/lib/file.rb')
+ AssertLSPLanguage 'ruby'
+ AssertLSPOptions {}
+ AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../ruby_fixtures/valid_ruby_app2')
+ AssertLSPAddress '127.0.0.1:7658'
diff --git a/test/fixers/test_ocamlformat_fixer_callback.vader b/test/fixers/test_ocamlformat_fixer_callback.vader
new file mode 100644
index 00000000..d2aee066
--- /dev/null
+++ b/test/fixers/test_ocamlformat_fixer_callback.vader
@@ -0,0 +1,40 @@
+Before:
+ Save g:ale_ocaml_ocamlformat_executable
+ Save g:ale_ocaml_ocamlformat_options
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_ocaml_ocamlformat_executable = 'xxxinvalid'
+ let g:ale_ocaml_ocamlformat_options = ''
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The ocamlformat callback should return the correct default values):
+ call ale#test#SetFilename('../ocaml-test-files/testfile.re')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' --inplace'
+ \ . ' %t',
+ \ },
+ \ ale#fixers#ocamlformat#Fix(bufnr(''))
+
+Execute(The ocamlformat callback should include custom ocamlformat options):
+ let g:ale_ocaml_ocamlformat_options = "-m 78"
+ call ale#test#SetFilename('../ocaml-test-files/testfile.re')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' ' . g:ale_ocaml_ocamlformat_options
+ \ . ' --inplace'
+ \ . ' %t',
+ \ },
+ \ ale#fixers#ocamlformat#Fix(bufnr(''))
diff --git a/test/ocaml-test-files/testfile.ml b/test/ocaml-test-files/testfile.ml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ocaml-test-files/testfile.ml
diff --git a/test/ruby_fixtures/valid_ruby_app1/Rakefile b/test/ruby_fixtures/valid_ruby_app1/Rakefile
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app1/Rakefile
diff --git a/test/ruby_fixtures/valid_ruby_app1/lib/file.rb b/test/ruby_fixtures/valid_ruby_app1/lib/file.rb
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app1/lib/file.rb
diff --git a/test/ruby_fixtures/valid_ruby_app2/Gemfile b/test/ruby_fixtures/valid_ruby_app2/Gemfile
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app2/Gemfile
diff --git a/test/ruby_fixtures/valid_ruby_app2/lib/file.rb b/test/ruby_fixtures/valid_ruby_app2/lib/file.rb
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/ruby_fixtures/valid_ruby_app2/lib/file.rb
diff --git a/test/test_go_to_definition.vader b/test/test_go_to_definition.vader
index c64db514..66c24fb6 100644
--- a/test/test_go_to_definition.vader
+++ b/test/test_go_to_definition.vader
@@ -213,7 +213,7 @@ Execute(Other files should be jumped to for LSP definition responses):
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ ],
\ g:expr_list
- AssertEqual [3, 7], getpos('.')[1:2]
+ AssertEqual [3, 8], getpos('.')[1:2]
AssertEqual {}, ale#definition#GetMap()
Execute(Locations inside the same file should be jumped to without using :edit):
@@ -235,7 +235,7 @@ Execute(Locations inside the same file should be jumped to without using :edit):
\ [
\ ],
\ g:expr_list
- AssertEqual [3, 7], getpos('.')[1:2]
+ AssertEqual [3, 8], getpos('.')[1:2]
AssertEqual {}, ale#definition#GetMap()
Execute(Other files should be jumped to in tabs for LSP definition responses):
@@ -258,7 +258,7 @@ Execute(Other files should be jumped to in tabs for LSP definition responses):
\ 'tabedit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ ],
\ g:expr_list
- AssertEqual [3, 7], getpos('.')[1:2]
+ AssertEqual [3, 8], getpos('.')[1:2]
AssertEqual {}, ale#definition#GetMap()
Execute(Definition responses with lists should be handled):
@@ -289,7 +289,7 @@ Execute(Definition responses with lists should be handled):
\ 'edit +3 ' . fnameescape(ale#path#Simplify(g:dir . '/completion_dummy_file')),
\ ],
\ g:expr_list
- AssertEqual [3, 7], getpos('.')[1:2]
+ AssertEqual [3, 8], getpos('.')[1:2]
AssertEqual {}, ale#definition#GetMap()
Execute(Definition responses with null response should be handled):