mirror of
https://github.com/dense-analysis/ale
synced 2024-12-30 10:02:14 +00:00
e0181f8832
It was returning 0 when it should be returning an empty string.
The 'AssertEqual' in the ale image is from an old version so it does not
check the types of the arguments.
This is already fixed in 427fe19104
Closes #3120
51 lines
1.3 KiB
VimL
51 lines
1.3 KiB
VimL
" Author: Jeffrey Lau - https://github.com/zoonfafer
|
|
" Description: Metals Language Server for Scala https://scalameta.org/metals/
|
|
|
|
call ale#Set('scala_metals_executable', 'metals-vim')
|
|
call ale#Set('scala_metals_project_root', '')
|
|
|
|
function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
|
|
let l:project_root = ale#Var(a:buffer, 'scala_metals_project_root')
|
|
|
|
if !empty(l:project_root)
|
|
return l:project_root
|
|
endif
|
|
|
|
let l:potential_roots = [
|
|
\ 'build.sc',
|
|
\ 'build.sbt',
|
|
\ '.bloop',
|
|
\ '.metals',
|
|
\]
|
|
|
|
for l:root in l:potential_roots
|
|
let l:project_root = ale#path#ResolveLocalPath(
|
|
\ a:buffer,
|
|
\ l:root,
|
|
\ ''
|
|
\)
|
|
|
|
if !empty(l:project_root)
|
|
return fnamemodify(
|
|
\ l:project_root,
|
|
\ ':h',
|
|
\)
|
|
endif
|
|
endfor
|
|
|
|
return ''
|
|
endfunction
|
|
|
|
function! ale_linters#scala#metals#GetCommand(buffer) abort
|
|
return '%e' . ale#Pad('stdio')
|
|
endfunction
|
|
|
|
call ale#linter#Define('scala', {
|
|
\ 'name': 'metals',
|
|
\ 'lsp': 'stdio',
|
|
\ 'language': 'scala',
|
|
\ 'executable': {b -> ale#Var(b, 'scala_metals_executable')},
|
|
\ 'command': function('ale_linters#scala#metals#GetCommand'),
|
|
\ 'project_root': function('ale_linters#scala#metals#GetProjectRoot'),
|
|
\})
|