It'd be nice if Scala projects could be linted by SBT, as currently the scalac checker basically just checks syntax. SBT recently announced support for the language server protocol, so maybe that could be leveraged to help integrating with it?
I'd be willing to do some leg work on this if I can get some general pointers on how to go about it.
I have a working prototype of this, but it needs some polishing before it's ready.
@Ophirr33 Are you still working on this?
I tried this but didn't get it to work. Here is some documentation about sbt language server protocol: https://www.scala-sbt.org/1.x/docs/sbt-server.html
There seems to be two different modes
The first mode is the default in sbt 1.1.x and a bit simpler. It's the default mode and doesn't require token authentication, but ch_open doesn't seem to have implementation for Unix domain sockets. Is there a way to connect to unix domain sockets in ALE/vim?
The TCP mode can be activated by setting serverConnectionType to ConnectionType.Tcp and seems to require an authentication token in initializationOptions which can be read from a file.
I would be happy to help with this, but I'm quite beginner with vimscript and vim plugins, so I appreciate if someone can help or give me pointers.
EDIT: It seems that token is not needed atm despite the documentation (sbt version 1.2.1), it doesn't even exist in the active.json
Hey @TK009, I had dropped this but was actually thinking about picking it back up since I'm back to full time scala dev. You can see some of the old stuff I did over in https://github.com/ophirr33/ale. It currently works if you set the sbt server to tcp mode (and I have some debug printing stuff you'll want to delete), but unix sockets ofc don't work.
The three solutions I see going forward are:
Got this to work pretty well by making a little stdio wrapper for sbtServer (https://github.com/Ophirr33/sbtio). I'm gonna clean it up / set up some installation options, then I'll set up a PR. If you wanna play with it now you can use the sbtio branch in my ale fork and cargo install sbtio directly.
You can write a linter which connects to a TCP socket. See this recently added linter: https://github.com/w0rp/ale/blob/master/ale_linters/ruby/solargraph.vim
That will work on all platforms with Vim 8.0, or new enough NeoVim versions. We could consider adding support for connecting to Unix domain sockets, but Unix domain socket connections would only work in some versions of BSD or Linux for Vim 8.0 and up, (netcat -U would be needed) or in newer versions of NeoVim on any Unix system. I recommend using TCP instead.
@Ophirr33 has implemented this now. You may need to change the address setting to tell it how to connect to the server, and you'll have to start the server yourself.
Most helpful comment
I have a working prototype of this, but it needs some polishing before it's ready.