scalameta / metals

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

Document new functionality #598

Closed olafurpg closed 5 years ago

olafurpg commented 5 years ago

A lot has happened since the last stable release. Before releasing v0.5, we should update the website to document new functionality such as

In particular, we should validate all the features work reliably in the supported editors (vim, emacs, sublime, atom).

olafurpg commented 5 years ago

This is the only remaining issue blocking a v0.5 release! I have published v0.5.0-M1 so people can try out a non-SNAPSHOT.

I have personally used VS Code + Metals for two weeks now and I'm pretty happy with the new functionality. It would be great to confirm before the stable release that the features also work outside of VS Code.

Below is a checklist of features that may need minor tweaking to improve the UX outside of VS Code. The cursor position is indicated by @@.

Completions

In LSP, it's called textDocument/completion but in the editor it may be called something else.

class Main {
    // should show "override def toString(): String` along with hashCode, equals, ...
    def @@
}
locally {
    val susan = "Susan"
    "Hello $susa@@" // should complete into s"Hello $susan"
}
locally {
  val numbers = List(1)
  s"Hello $numbers.head@@" // should complete into s"Hello ${numbers.head}"
}
Option(1) match {
  case S@@ // Should suggest `Some` at the top, not `Seq`
}
// before
Option(1) match@@
// after
Option(1) match {
  case None => @@
  case Some(value) =>
}
List(Option(1)).map {
  case@@ // should suggest "case None =>` and `case Some(value) =>`

Server configuration

Hover (aka. show type at point)

In LSP, it's called textDocument/hover but in the editor it may be called something else.

Server configuration

Signature help (aka. parameter hints)

In LSP, it's called textDocument/signatureHelp but in the editor it may be called something else.

Server configuration

Folding ranges

In LSP, it's called textDocument/foldingRange but in the editor it may be called something else.

Document highlight

In LSP, it's called textDocument/documentHighlight but in the editor it may be called something else.

JesusMtnez commented 5 years ago

I've been using metals with Emacs for the past two weeks (SNAPSHOTS versions). So far everything I tried worked pretty well. I'll try to test everything in this issue this weekend or next week to confirm Emacs integration :smile:

Thank you for this amazing work! :clap: :tada:

olafurpg commented 5 years ago

BTW, to try out v0.5.0-M1

https://scalameta.org/metals/docs/editors/vscode.html#using-latest-metals-snapshot

Atry commented 5 years ago

I found some error messages in vscode's console

bad option: -P:semanticdb:synthetics:on
bad option: -P:semanticdb:failures:warning

I have to manually add the following settings in my build.sbt in case of those errors

addCompilerPlugin("org.scalameta" % "semanticdb-scalac" % "4.1.5" cross CrossVersion.full)
olafurpg commented 5 years ago

@Atry Thank for trying it out! Please report a separate issue, that looks unrelated to the new release.

Atry commented 5 years ago

I just reported the issue at https://github.com/scalameta/metals/issues/647

Now I am busy uninstalling IntelliJ

ivanopagano commented 5 years ago

Is it expected that the hover docs cannot define the exact collection in a overriden method, like in the image?

image

ivanopagano commented 5 years ago

I see ${coll} but I can't tell if it's a generic placeholder, or if some substitution should happen, based on the current variable type

gabro commented 5 years ago

@ivanopagano that is a bug with the Scaladoc to Markdown conversion, which is not following the coll variable, defined with a @define declaration.

See

image

and

image

/cc @mudsam who worked on this

From https://github.com/scala/scala/blob/v2.12.1/src/library/scala/collection/IterableLike.scala#L1

Tracking this in #648, thanks for reporting!

gvolpe commented 5 years ago

Fantastic work @olafurpg :tada: !

I'm a long time user of NeoVim and I've been using one of the latest snapshots for a while and I'm pretty impressed with how fast it is!

Just to give you some feedback I got completions working using vim-lsc but I had to tweak it a bit to got it working properly (i.e. disabling showing empty preview window on autocompletion).

I gave coc.vim a go but it was hard to get it working smoothly. I don't know about others, I felt it buggy like it was last time I tried it but I might have tried it with the wrong config or so.

Keep up the amazing work!

ceedubs commented 5 years ago

Great, work @olafurpg and others involved!

I've been using Metals snapshots with Neovim and vim-lsc pretty steadily at work for a couple of months now. Overall, I've been very pleased. I haven't figured out how to get a working Nix derivation for coc.nvim yet, so I only have data for vim-lsc.

Certain things that I do seem to get it into a state where completion no longer works until I restart Neovim. I don't see anything unusual in the logs when this happens, and I haven't reported it yet, because I don't have a minimal example to reproduce it. I'll keep an eye on it but thought that this might be a good time to put it on someone's radar.

I've regularly used most of the features described here. Below are my results walking through them just now. Most things just work. I've listed below things that don't work quite as desired (I haven't mentioned the things that do work perfectly).

olafurpg commented 5 years ago

@gvolpe @ceedubs Thank you for the feedback! I opened a separate ticket to discuss vim https://github.com/scalameta/metals/issues/650 The and $0 markers are part of the LSP snippet format (https://macromates.com/manual/en/snippets) that metals uses to declare "increase indent" and "place cursor here", respectively

coreyoconnor commented 5 years ago

Looking good so far under emacs. I haven't tested everything in the list.

I'm using console mode emacs with evil and company mode. What I've confirmed working:

  1. completions (using lsp-company). No issues encountered.
  2. hover. Markdown rendering does not occur. I suspect this is specific to console mode emacs. markdown-mode is installed.
  3. highlight. No issues encountered.
cb372 commented 5 years ago

FWIW I've been using 0.5.0-M1 for a few hours with neovim (0.3.4) and vim-lsc (the latest HEAD, 4fd4668) and it's great so far! I've only encountered two bugs:

  1. When I choose to import the build, it works (I can see metals start doing stuff in the logs) but I get this weird error:

    Screenshot 2019-04-11 at 20 46 14
  2. When I close vim I see an error on the console after vim has disappeared:

    [lsc:Error] Command exited unexpectedly: metals-vim

    The only thing logged to metals.log at shutdown is this, which looks pretty normal:

    INFO  shutting down Metals
    10potj.socket' finished.
    INFO  bloop exit: 0
tdroxler commented 5 years ago

Awesome work!

I'm using neovim with LanguageClient-neovim, so far so good, but I still need to use it for few days to give and meaningful feedback. I already saw some of the problems reported by @ceedubs so I suppose it's neovim related, not necessary lsp client.

By the way now LanguageClient-neovim DO implement window/showMessageRequest :tada:

I'll try to keep you updated as soon as I have tested it a bit more.

Congrats again for the work