diff options
-rw-r--r-- | ale_linters/erlang/erlang_ls.vim | 9 | ||||
-rw-r--r-- | test/linter/test_erlang_erlang_ls.vader | 44 | ||||
-rw-r--r-- | test/test-files/erlang/app_with_erlang_ls_config/deps/dep/erlang_ls.config (renamed from test/test-files/erlang/app/_build/default/lib/dep/rebar.lock) | 0 | ||||
-rw-r--r-- | test/test-files/erlang/erlang_mk_app/deps/dep/erlang.mk (renamed from test/test-files/erlang/app/_build/default/lib/dep/src/dep.erl) | 0 | ||||
-rw-r--r-- | test/test-files/erlang/erlang_mk_app/erlang.mk (renamed from test/test-files/erlang/app/rebar.lock) | 0 | ||||
-rw-r--r-- | test/test-files/erlang/rebar3_app/_build/default/lib/dep/rebar.lock (renamed from test/test-files/erlang/app/src/app.erl) | 0 | ||||
-rw-r--r-- | test/test-files/erlang/rebar3_app/_checkouts/dep/_build/.gitkeep (renamed from test/test-files/erlang/app_with_erlang_ls_config/_build/default/lib/dep/src/dep.erl) | 0 | ||||
-rw-r--r-- | test/test-files/erlang/rebar3_app/_checkouts/dep/rebar.lock (renamed from test/test-files/erlang/app_with_erlang_ls_config/src/app.erl) | 0 | ||||
-rw-r--r-- | test/test-files/erlang/rebar3_app/rebar.lock (renamed from test/test-files/erlang/kerl_otp_root/lib/stdlib-4.1.1/src/array.erl) | 0 |
9 files changed, 41 insertions, 12 deletions
diff --git a/ale_linters/erlang/erlang_ls.vim b/ale_linters/erlang/erlang_ls.vim index b747e454..0f070459 100644 --- a/ale_linters/erlang/erlang_ls.vim +++ b/ale_linters/erlang/erlang_ls.vim @@ -21,7 +21,14 @@ function! s:GetCommand(buffer) abort endfunction function! s:FindProjectRoot(buffer) abort - let l:markers = ['_build/', 'erlang_ls.config', 'rebar.lock'] + let l:markers = [ + \ '_checkouts/', + \ '_build/', + \ 'deps/', + \ 'erlang_ls.config', + \ 'rebar.lock', + \ 'erlang.mk', + \] " This is a way to find Erlang/OTP root (the one that is managed " by kerl or asdf). Useful if :ALEGoToDefinition takes us there. diff --git a/test/linter/test_erlang_erlang_ls.vader b/test/linter/test_erlang_erlang_ls.vader index 3870b5c4..2a3d7a70 100644 --- a/test/linter/test_erlang_erlang_ls.vader +++ b/test/linter/test_erlang_erlang_ls.vader @@ -1,8 +1,9 @@ Before: - let b:files = '../test-files/erlang' call ale#assert#SetUpLinterTest('erlang', 'erlang_ls') After: + unlet! b:root + call ale#assert#TearDownLinterTest() Execute(The default command should be correct): @@ -30,19 +31,40 @@ Execute(Log directory should be configurable): \ . ' --log-level=' . ale#Escape('info') Execute(Project root should be detected using erlang_ls.config): - call ale#test#SetFilename(b:files . '/app_with_erlang_ls_config/src/app.erl') - AssertLSPProject ale#test#GetFilename(b:files . '/app_with_erlang_ls_config') + let b:root = '../test-files/erlang/app_with_erlang_ls_config' + + call ale#test#SetFilename(b:root . '/src/app.erl') + AssertLSPProject ale#test#GetFilename(b:root) + + call ale#test#SetFilename(b:root . '/_build/default/lib/dep/src/dep.erl') + AssertLSPProject ale#test#GetFilename(b:root) - call ale#test#SetFilename(b:files . '/app_with_erlang_ls_config/_build/default/lib/dep/src/dep.erl') - AssertLSPProject ale#test#GetFilename(b:files . '/app_with_erlang_ls_config') + call ale#test#SetFilename(b:root . '/deps/dep/src/dep.erl') + AssertLSPProject ale#test#GetFilename(b:root) Execute(Root of Rebar3 project should be detected): - call ale#test#SetFilename(b:files . '/app/src/app.erl') - AssertLSPProject ale#test#GetFilename(b:files . '/app') + let b:root = '../test-files/erlang/rebar3_app' + + call ale#test#SetFilename(b:root . '/src/app.erl') + AssertLSPProject ale#test#GetFilename(b:root) + + call ale#test#SetFilename(b:root . '/_build/default/lib/dep/src/dep.erl') + AssertLSPProject ale#test#GetFilename(b:root) - call ale#test#SetFilename(b:files . '/app/_build/default/lib/dep/src/dep.erl') - AssertLSPProject ale#test#GetFilename(b:files . '/app') + call ale#test#SetFilename(b:root . '/_checkouts/dep/src/dep.erl') + AssertLSPProject ale#test#GetFilename(b:root) + +Execute(Root of Erlang.mk project should be detected): + let b:root = '../test-files/erlang/erlang_mk_app' + + call ale#test#SetFilename(b:root . '/src/app.erl') + AssertLSPProject ale#test#GetFilename(b:root) + + call ale#test#SetFilename(b:root . '/deps/dep/src/dep.erl') + AssertLSPProject ale#test#GetFilename(b:root) Execute(Root of kerl managed Erlang/OTP installation should be detected): - call ale#test#SetFilename(b:files . '/kerl_otp_root/lib/stdlib-4.1.1/array.erl') - AssertLSPProject ale#test#GetFilename(b:files . '/kerl_otp_root') + let b:root = '../test-files/erlang/kerl_otp_root' + + call ale#test#SetFilename(b:root . '/lib/stdlib-4.1.1/array.erl') + AssertLSPProject ale#test#GetFilename(b:root) diff --git a/test/test-files/erlang/app/_build/default/lib/dep/rebar.lock b/test/test-files/erlang/app_with_erlang_ls_config/deps/dep/erlang_ls.config index e69de29b..e69de29b 100644 --- a/test/test-files/erlang/app/_build/default/lib/dep/rebar.lock +++ b/test/test-files/erlang/app_with_erlang_ls_config/deps/dep/erlang_ls.config diff --git a/test/test-files/erlang/app/_build/default/lib/dep/src/dep.erl b/test/test-files/erlang/erlang_mk_app/deps/dep/erlang.mk index e69de29b..e69de29b 100644 --- a/test/test-files/erlang/app/_build/default/lib/dep/src/dep.erl +++ b/test/test-files/erlang/erlang_mk_app/deps/dep/erlang.mk diff --git a/test/test-files/erlang/app/rebar.lock b/test/test-files/erlang/erlang_mk_app/erlang.mk index e69de29b..e69de29b 100644 --- a/test/test-files/erlang/app/rebar.lock +++ b/test/test-files/erlang/erlang_mk_app/erlang.mk diff --git a/test/test-files/erlang/app/src/app.erl b/test/test-files/erlang/rebar3_app/_build/default/lib/dep/rebar.lock index e69de29b..e69de29b 100644 --- a/test/test-files/erlang/app/src/app.erl +++ b/test/test-files/erlang/rebar3_app/_build/default/lib/dep/rebar.lock diff --git a/test/test-files/erlang/app_with_erlang_ls_config/_build/default/lib/dep/src/dep.erl b/test/test-files/erlang/rebar3_app/_checkouts/dep/_build/.gitkeep index e69de29b..e69de29b 100644 --- a/test/test-files/erlang/app_with_erlang_ls_config/_build/default/lib/dep/src/dep.erl +++ b/test/test-files/erlang/rebar3_app/_checkouts/dep/_build/.gitkeep diff --git a/test/test-files/erlang/app_with_erlang_ls_config/src/app.erl b/test/test-files/erlang/rebar3_app/_checkouts/dep/rebar.lock index e69de29b..e69de29b 100644 --- a/test/test-files/erlang/app_with_erlang_ls_config/src/app.erl +++ b/test/test-files/erlang/rebar3_app/_checkouts/dep/rebar.lock diff --git a/test/test-files/erlang/kerl_otp_root/lib/stdlib-4.1.1/src/array.erl b/test/test-files/erlang/rebar3_app/rebar.lock index e69de29b..e69de29b 100644 --- a/test/test-files/erlang/kerl_otp_root/lib/stdlib-4.1.1/src/array.erl +++ b/test/test-files/erlang/rebar3_app/rebar.lock |