2018-08-30 15:40:04 -04:00
|
|
|
" Author: Bartolomeo Stellato <bartolomeo.stellato@gmail.com>
|
|
|
|
" Description: A language server for Julia
|
|
|
|
|
2018-09-07 13:16:22 -04:00
|
|
|
" Set julia executable variable
|
|
|
|
call ale#Set('julia_executable', 'julia')
|
|
|
|
|
2018-08-30 15:40:04 -04:00
|
|
|
function! ale_linters#julia#languageserver#GetCommand(buffer) abort
|
2018-09-07 11:11:29 -04:00
|
|
|
let l:julia_executable = ale#Var(a:buffer, 'julia_executable')
|
2018-09-19 09:51:20 -04:00
|
|
|
let l:cmd_string = 'using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);'
|
2018-09-08 16:05:34 -04:00
|
|
|
|
2018-09-09 10:09:05 -04:00
|
|
|
return ale#Escape(l:julia_executable) . ' --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string)
|
2018-08-30 15:40:04 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('julia', {
|
|
|
|
\ 'name': 'languageserver',
|
|
|
|
\ 'lsp': 'stdio',
|
2019-02-22 13:05:04 -05:00
|
|
|
\ 'executable': {b -> ale#Var(b, 'julia_executable')},
|
|
|
|
\ 'command': function('ale_linters#julia#languageserver#GetCommand'),
|
2018-09-07 11:11:29 -04:00
|
|
|
\ 'language': 'julia',
|
2019-02-22 13:05:04 -05:00
|
|
|
\ 'project_root': function('ale#julia#FindProjectRoot'),
|
2018-08-30 15:40:04 -04:00
|
|
|
\})
|