scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.06k stars 320 forks source link

Documentation: How to connect to the server #205

Closed martijnhoekstra closed 6 years ago

martijnhoekstra commented 6 years ago

I'm working on a scala lsp client to connect to sbt server. I'd also like to be able to connect to metals, but I can't find any documentation on how to start the metals server, and how to connect to it (address, wire protocol and initialization object requirements)

gabro commented 6 years ago

There's currently no documentation on this, but your best bet is to use the vscode extension implementation as a reference.

Here it is: https://github.com/scalameta/metals/blob/master/vscode-extension/src/extension.ts#L17-L54

It's in TypeScript, but it should be pretty straightforward to follow.

Hope that helps.

laughedelic commented 6 years ago

@martijnhoekstra which editor/IDE are you targeting? For the sbt server there is a VSCode plugin in the sbt repo: https://github.com/sbt/sbt/tree/1.x/vscode-sbt-scala (there are also writeups about integrating it with Neovim and Sublime).

And for Metals, besides the VSCode plugin there is a launcher bash-script: https://github.com/scalameta/metals/blob/master/bin/start-server.sh (which is a bit outdated, I think)

It should be basically just running this command (assuming you have coursier around):

coursier launch \
  --repository bintray:scalameta/maven \
  org.scalameta:metals_2.12:$version \
  --main scala.meta.metals.Main
martijnhoekstra commented 6 years ago

@laughedelic I'm trying to target Visual Studio (non-code) through a VSIX extension.

olafurpg commented 6 years ago

Superseded by #217

olafurpg commented 6 years ago

Opened #256 to document how to connect to metals from a new editor client