2018-08-30 19:40:04 +00:00
|
|
|
" Author: Bartolomeo Stellato <bartolomeo.stellato@gmail.com>
|
|
|
|
" Description: A language server for Julia
|
|
|
|
|
2018-09-07 17:16:22 +00:00
|
|
|
" Set julia executable variable
|
|
|
|
call ale#Set('julia_executable', 'julia')
|
|
|
|
|
2018-08-30 19:40:04 +00:00
|
|
|
function! ale_linters#julia#languageserver#GetCommand(buffer) abort
|
2018-09-07 15:11:29 +00:00
|
|
|
let l:julia_executable = ale#Var(a:buffer, 'julia_executable')
|
2020-12-11 23:16:09 +00:00
|
|
|
let l:cmd_string = 'using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);'
|
2018-09-08 20:05:34 +00:00
|
|
|
|
2020-12-11 23:37:14 +00:00
|
|
|
return ale#Escape(l:julia_executable) . ' --project=@. --startup-file=no --history-file=no -e ' . ale#Escape(l:cmd_string)
|
2018-08-30 19:40:04 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('julia', {
|
|
|
|
\ 'name': 'languageserver',
|
2023-09-13 23:38:12 +00:00
|
|
|
\ 'aliases': ['julials'],
|
2018-08-30 19:40:04 +00:00
|
|
|
\ 'lsp': 'stdio',
|
2019-02-22 18:05:04 +00:00
|
|
|
\ 'executable': {b -> ale#Var(b, 'julia_executable')},
|
|
|
|
\ 'command': function('ale_linters#julia#languageserver#GetCommand'),
|
2018-09-07 15:11:29 +00:00
|
|
|
\ 'language': 'julia',
|
2019-02-22 18:05:04 +00:00
|
|
|
\ 'project_root': function('ale#julia#FindProjectRoot'),
|
2018-08-30 19:40:04 +00:00
|
|
|
\})
|