Closed olafurpg closed 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 @@
.
In LSP, it's called textDocument/completion
but in the editor it may be called
something else.
println@@
Predef.println@@
.Future@@
and if you select the option Future - scala.concurrent
it adds a
local import scala.concurrent.Future
def @@
and it
shows methods that can be overridden by the superclassclass Main {
// should show "override def toString(): String` along with hashCode, equals, ...
def @@
}
assert(true, mess@@)
should complete message =
assert@@
should move the cursor
inside parentheses like assert(@@)
x$1
, for example "".substrin@@
should display
substring(beginIndex: Int, endIndex: Int): String
instead of
substring(x$1: Int, x$2: Int): String
. I suspect this won't work in Vim or
Sublime, you may need to trigger a command in Emacs.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`
}
Predef.@@
should trigger completion.// 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) =>`
-Dmetals.signature-help.command
: a command ID to automatically trigger
signature help (parameter hints) when a completion snippet moves the cursor
into parentheses assert(@@)
. In VS Code, this value is
"editor.action.triggerParameterHints"
.-Dmetals.completion.command
: a command ID to trigger a follow-up completion
in the editor after selecting certain completions. In VS Code, this value is
"editor.action.triggerSuggest"
.-Dmetals.override-def-format
: valid values are ascii
(default) or
unicode
. If set to unicode, then Metals uses the symbols ⏫ and 🔼 instead
of "override def" and "def" to save horizontal space in the UI.In LSP, it's called textDocument/hover
but in the editor it may be called
something else.
Option(1).ma@@p(_ + 1)
should appear like this
.map(_.toString)
is
not highlighted-Dmetals.hover.documentation
: a boolean true
(default) or false
. If set
to false, then the docstring is left empty, which can be desirable if you only
care about seeing the expression type and symbol signature.In LSP, it's called textDocument/signatureHelp
but in the editor it may be
called something else.
y: Int
in the image above.math.max
has
four overloads that can be cycled through by clicking the up/down arrows in
the image above.(
should automatically trigger signature help.-Dmetals.signature-help.documentation
: a boolean true
(default) or
false
. If set to false, then the docstring is left empty, which can be
desirable if you only care about seeing the symbol signature.In LSP, it's called textDocument/foldingRange
but in the editor it may be
called something else.
In LSP, it's called textDocument/documentHighlight
but in the editor it may be
called something else.
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:
BTW, to try out v0.5.0-M1
https://scalameta.org/metals/docs/editors/vscode.html#using-latest-metals-snapshot
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)
@Atry Thank for trying it out! Please report a separate issue, that looks unrelated to the new release.
I just reported the issue at https://github.com/scalameta/metals/issues/647
Now I am busy uninstalling IntelliJ
Is it expected that the hover docs cannot define the exact collection in a overriden method, like in the image?
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
@ivanopagano that is a bug with the Scaladoc to Markdown conversion, which is not following the coll
variable, defined with a @define
declaration.
See
and
/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!
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!
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).
import Future@@
works, but local import isn't added for something like Future@@
(with vim-lsc).assert($0)
and the cursor is not inside the parentheses. I think that this is a known limitation of using Metals with vim-lsc?x$1
on vim-lsc.s
at the beginning of your string, which is missing in the example${numbers.head$0}
, which I think is consistent with completion templates generally being wonky when using Metals with vim-lsc.Option(1) match { case None => $0 case Some(x) =>
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).