diff --git a/README.md b/README.md index e8108733..d8eb5d87 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,7 @@ formatting. | JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint-cli), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo) | JSON | [fixjson](https://github.com/rhysd/fixjson), [jsonlint](http://zaa.ch/jsonlint/), [jq](https://stedolan.github.io/jq/), [prettier](https://github.com/prettier/prettier) | | Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !!, [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions | +| Julia | [LanguageServer.jl](https://github.com/JuliaEditorSupport/LanguageServer.jl) | | LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) | | Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) | | LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) | diff --git a/ale_linters/julia/languageserver.vim b/ale_linters/julia/languageserver.vim index 1755c794..d59e9959 100644 --- a/ale_linters/julia/languageserver.vim +++ b/ale_linters/julia/languageserver.vim @@ -1,30 +1,16 @@ " Author: Bartolomeo Stellato " 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) - + let l:julia_executable = ale#Var(a:buffer, 'julia_executable') + return ale#Escape(l:julia_executable) . ale#Escape("--startup-file=no --history-file=no -e 'using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);'") endfunction call ale#linter#Define('julia', { \ 'name': 'languageserver', \ 'lsp': 'stdio', -\ 'executable_callback': 'ale_linters#julia#languageserver#GetExecutable', +\ 'executable_callback': ale#VarFunc('julia_executable'), \ 'command_callback': 'ale_linters#julia#languageserver#GetCommand', +\ 'language': 'julia', \ 'project_root_callback': 'ale#julia#FindProjectRoot', \}) diff --git a/autoload/ale/julia.vim b/autoload/ale/julia.vim index a6c0ee4a..71243763 100644 --- a/autoload/ale/julia.vim +++ b/autoload/ale/julia.vim @@ -1,4 +1,10 @@ -" Set just so tests can override it. +" Author: Bartolomeo Stellato bartolomeo.stellato@gmail.com +" Description: Functions for integrating with Julia tools + +" Set julia executable variable +call ale#Set('julia_executable', 'julia') + +" Find the nearest dir contining a git project as julia project let g:__ale_julia_project_filenames = ['.git/HEAD'] function! ale#julia#FindProjectRoot(buffer) abort for l:project_filename in g:__ale_julia_project_filenames diff --git a/doc/ale-julia.txt b/doc/ale-julia.txt new file mode 100644 index 00000000..3795c8ef --- /dev/null +++ b/doc/ale-julia.txt @@ -0,0 +1,20 @@ +=============================================================================== +ALE Julia Integration *ale-julia-options* + +=============================================================================== +languageserver *ale-julia-languageserver* + +To enable Julia LSP linter you need to install the LanguageServer.jl package +within julia. + +g:ale_julia_executable *g:ale_julia_executable* + *b:ale_julia_executable* + + Type: String + Default: 'julia' + + Path to the julia exetuable. + +=============================================================================== + vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: +