mirror of
https://github.com/dense-analysis/ale
synced 2024-12-25 23:52:22 +00:00
Started adding julia languageserver
This commit is contained in:
parent
ea01cc708b
commit
8bf5d144ed
30
ale_linters/julia/languageserver.vim
Normal file
30
ale_linters/julia/languageserver.vim
Normal file
@ -0,0 +1,30 @@
|
||||
" Author: Bartolomeo Stellato <bartolomeo.stellato@gmail.com>
|
||||
" Description: A language server for Julia
|
||||
|
||||
call ale#Set('julia_languageserver_executable', 'julia')
|
||||
call ale#Set('julia_languageserver_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#julia#languageserver#GetExecutable(buffer) abort
|
||||
let l:binary = ale#Var(a:buffer, 'julia_languageserver_executable')
|
||||
return ale#Escape(l:binary)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#julia#languageserver#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#julia#languageserver#GetExecutable(a:buffer)
|
||||
let l:options = '--startup-file=no --history-file=no -e ' . '"
|
||||
\ using LanguageServer;
|
||||
\ server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false);
|
||||
\ server.runlinter = true;
|
||||
\ run(server);"'
|
||||
|
||||
return ale#Escape(l:executable) . ale#Escape(l:options)
|
||||
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('julia', {
|
||||
\ 'name': 'languageserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#julia#languageserver#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#julia#languageserver#GetCommand',
|
||||
\ 'project_root_callback': 'ale#julia#FindProjectRoot',
|
||||
\})
|
21
autoload/ale/julia.vim
Normal file
21
autoload/ale/julia.vim
Normal file
@ -0,0 +1,21 @@
|
||||
" Set just so tests can override it.
|
||||
let g:__ale_julia_project_filenames = ['.git/HEAD']
|
||||
function! ale#julia#FindProjectRoot(buffer) abort
|
||||
for l:project_filename in g:__ale_julia_project_filenames
|
||||
let l:full_path = ale#path#FindNearestFile(a:buffer, l:project_filename)
|
||||
|
||||
if !empty(l:full_path)
|
||||
let l:path = fnamemodify(l:full_path, ':h')
|
||||
|
||||
" Correct .git path detection.
|
||||
if fnamemodify(l:path, ':t') is# '.git'
|
||||
let l:path = fnamemodify(l:path, ':h')
|
||||
endif
|
||||
|
||||
return l:path
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user