[ANN] Julia support for vim/neovim plugin ALE (Asyncronous Lint Engine) using LanguageServer.jl

Hi all,

I have just written a Julia integration for the vim/neovim plugin ALE (Asyncronous Lint Engine) using LanguageServer.jl. I believe it is one of the best vim plugins and we needed Julia support.

The integration searches for REQUIRE, Project.toml or Manifest.toml files to get the project root and then it starts the language server instance. It works out of the box after installing ale in vim/neovim and LanguageServer.jl.

The LanguageServer.jl package has still room for improvement, but I believe this is a good start!

Hope you find it useful!

Bartolomeo

17 Likes

Very nice, thanks for your work!

It seems the dependency StaticLint.jl is not registered. Any plans to get the latter registered?

The dependency DocumentFormat.jl is also in need of a tag.

1 Like

I’m working (fairly slowly) to get both up to speed for v1.0. StaticLint should get tagged soon

2 Likes

Sounds great!

Just tested it, but somehow I cannot get completion and syntax checks to work. May be I am missing something in the following:

All I see is some CPU load in the background when pressing or when saving a *.jl file. using the 3 packages on Julia REPL works fine, there are no warnings or errors.

I do think some documentation is called for if you guys can provide. I was also a little confused about how to set things up.

But it seemed like this thing just rolled out the door, so I didn’t want to seem to pesty. :slightly_smiling_face:

Unfortunately it is only working for me in Julia 0.6 for now. I am not sure the latest LanguageServer.jl release is compatible with 0.7.

Have you tried to run :ALEInfo and check if the language server command started?

ALE looks for a project file to find the root of the project. If it does not find it, nothing starts.

Sounds really awesome. However, I am not even able to build StaticLint:

  Building StaticLint → `~/.julia/packages/StaticLint/o1AQ8/deps/build.log`
┌ Error: Error building `StaticLint`:
│ ERROR: LoadError: syntax: extra token "AssociativeWrapper" after end of expression
│ Stacktrace:
│  [1] include at ./boot.jl:317 [inlined]
│  [2] include_relative(::Module, ::String) at ./loading.jl:1038
│  [3] include(::Module, ::String) at ./sysimg.jl:29
│  [4] top-level scope at none:2
│  [5] eval at ./boot.jl:319 [inlined]
│  [6] eval(::Expr) at ./client.jl:389
│  [7] top-level scope at ./none:3
│ in expression starting at /Users/tamasgal/.julia/packages/JSON/Zg7L7/src/JSON.jl:18
│ ERROR: LoadError: LoadError: Failed to precompile JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] to /Users/tamasgal/.julia/compiled/v1.0/JSON/uf6oy.ji.
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] macro expansion at ./logging.jl:313 [inlined]
│  [3] compilecache(::Base.PkgId, ::String) at ./loading.jl:1184
│  [4] _require(::Base.PkgId) at ./logging.jl:311
│  [5] require(::Base.PkgId) at ./loading.jl:852
│  [6] macro expansion at ./logging.jl:311 [inlined]
│  [7] require(::Module, ::Symbol) at ./loading.jl:834
│  [8] include at ./boot.jl:317 [inlined]
│  [9] include_relative(::Module, ::String) at ./loading.jl:1038
│  [10] include(::Module, ::String) at ./sysimg.jl:29
│  [11] include(::String) at ./client.jl:388
│  [12] top-level scope at none:0
│  [13] include at ./boot.jl:317 [inlined]
│  [14] include_relative(::Module, ::String) at ./loading.jl:1038
│  [15] include(::Module, ::String) at ./sysimg.jl:29
│  [16] include(::String) at ./client.jl:388
│  [17] top-level scope at none:0
│ in expression starting at /Users/tamasgal/.julia/packages/StaticLint/o1AQ8/src/symbolserver.jl:2
│ in expression starting at /Users/tamasgal/.julia/packages/StaticLint/o1AQ8/deps/build.jl:1
└ @ Pkg.Operations /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1068

You just need to install LanguageServer.jl at the moment and it should work out of the box if you set the right g:ale_julia_executable. Unfortunately just for Julia 0.6 at the moment.

Thanks, I’ll have to wait until 0.7/1.0 since I don’t use earlier versions anymore.

This alternative seems to work with julia v1.0 and LanguageServer#master.

1 Like

:ALEInfo says there’s a Julia process with the LanguageServer running. Though it exits quickly and is re-launched by ALE everytime I trigger Omnicomplete or generally, when I write something in my *.jl file.

I’ve taken a look into ale_linters/julia/languageserver.vim: In Julia 0.7/1.0, STDOUT and STDIN have to be lowercase. After changing that in the variable cmd_string, the Julia process with the LanguageServer does not crash anymore and stays running until I close my *.jl file.

Thank you for pointing that out. I have pushed a commit now to change those variables to all lowercase, which should hopefully work for 0.6 and 0.7.

1 Like

Hi. I love the ALE integration with Julia!!
Is this working for Julia 1.x?

I haven’t seen anyone getting it working so far on Julia 1.x.

Btw: Thanks for updating LanguageServer.jl’s Github Wiki page for vim. Transferring the embedded Julia code snippet to ALE now at least prevents ALE’s Julia background process from crashing. One step further :slight_smile:

1 Like

Thank you for replying :grin:.

Transferring the embedded Julia code snippet to ALE now at least prevents ALE’s Julia background process from crashing

That’s good news. vim-lsp is the same situation. The LanguageServer.jl is running, but it is not working… I hope next one step.