We are excited to announce the release of Metals v0.7.6, which will most likely
be the last release before the v0.8.0 one. This release includes support for new
Scala versions (2.12.10, 2.13.1) and a couple of fixes. It also adds a new
formatting on paste feature for multiline strings.
Metals is a language server for Scala that works with VS Code, Atom, Vim,
Sublime Text and Emacs. Metals is developed at the
Scala Center and VirtusLab
along with contributors from the community.
Thanks to @gabro's continuing effort we were able to add support for both new
Scala versions. Those versions fix a couple of important regressions and are now
available to use with Metals!
Formatting on paste for multiline strings
Whenever text is pasted into a multiline string with | it will be properly
formatted by Metals:
To enable this feature you need to enable formatting on paste in your editor of
choice. In Visual Studio Code it can be done via modifying a checkbox:
Fixes for autofill feature
After releasing the experimental autofill feature we addressed feedback by:
not filling in the default arguments
adding ??? as a first option when alternative values are available to avoid
mistakes
add subtypes as valid values
only show autofill option when using named parameters or by explicitly typing
autofill...
Let us know if you have any further feedback!
Contributors
Big thanks to everybody who contributed to this release!
$ git shortlog -sn --no-merges v0.7.5..v0.7.6
Tomasz Godzik
Marek Żarnowski
Gabriele Petronella
Ólafur Páll Geirsson
Sam Halliday
We are excited to announce the release of Metals v0.7.5 - codename "Thorium" 🎉
The release includes couple of bug fixes for 0.7.2, which were present in some
rare scenarios. We also added a new experimental feature, which we would be
happy to get feedback about.
Metals is a language server for Scala that works with VS Code, Atom, Vim,
Sublime Text and Emacs. Metals is developed at the
Scala Center and VirtusLab
along with contributors from the community.
multiple fixes after adding support for Scala 2.12.9
fixes for automatic addition of | in multiline strings
Add auto-fill option to case classes
Whenever we invoke a method and try completions inside the brackets there is an
additional option to allow Metals to deduce what should be filled for each
parameter.
This algorithm checks if there exists a value in scope with the same type as the
parameters' and then works according to the rules below:
1. If there is only one candidate, use it.
2. If there is more than one, give user an alternative to choose one of them.
3. Otherwise use use "???".
This feature also uses the snippets syntax to allow to quickly go over the
auto-filled parameters and choose or replace the auto-filled values.
Deduce values for named parameters completions
Leveraging the work that went into the previous feature, we were also able to
provide additional support for concrete values in named parameter completions.
We generate completion item for each value that fits the type of the parameter.
Multiple fixes after adding support for Scala 2.12.9
After updating Metals to work with Scala 2.12.9 it turned out that completions
and hover didn't work correctly and due to the presentation compiler crashing in
the following scenarios:
whenever an older version of SemanticDB plugin was used as was the case with
Mill
when using Scala 2.12.8 without SemanticDB plugin
Both issues have now been fixed and additionally we updated the default Mill
version to 0.5.1, which works correctly with Scala 2.12.9.
Fixes for automatic addition of | in multiline strings
We now make sure that stripMargin exists when adding | automatically in
multiline strings. This could cause issues in some scenarios, where multiline
string contained |, but it was not only used for formatting.
Additionally, we fixed the feature to also work in interpolated strings, which
was missing in the previous release.
Contributors
Big thanks to everybody who contributed to this release!
We are excited to announce the release of Metals v0.7.2 - codename "Thorium" 🎉
The release includes mostly bug fixes with some smaller new features. We are
skipping over 0.7.1 due to a critical bug we discovered
Metals is a language server for Scala that works with VS Code, Atom, Vim,
Sublime Text and Emacs. Metals is developed at the
Scala Center and VirtusLab
along with contributors from the community.
automatically add package definition to new source files
automatically insert pipes in multiline string
a lot of miscellaneous fixes
Fix completions in case of inline comments
Previously, completions after a comment and newline would yield no results:
valList(1,2,3)
.map(num => num + 1) // comment
@@
This was fixed by the Metals team in the presentation compiler itself for 2.12.9
and 2.13.1, however we also added a workaround for all supported older Scala
versions.
Add support for non-directory sources
In case that your build tool supports having single files as sources, we now
offer full support for them. That corresponds to the most recent BSP
specification
request
Automatically add package definition to new source files
For every new Scala file we automatically add package definition based on the
relative path between the new source file and source root. This is done using
applyWorkspaceEdit method, which causes the change to be done in editor and this
can easily be rewerted like any other change you would type.
We also added support for package objects. Whenever you create package.scala
file, we will automatically create the barebone definition of the package
object.
There is still some work to be done about moving files between packages, which
will be addressed in the next release.
Big thanks to the first time contributor from VirtusLab Tomasz Dudzik for
implementing most of the functionality! 🎉
Automatically insert pipes in multiline string
We finally managed to properly support adding | in multiline strings using the
onTypeFormatting method. Previous implementation was very naive and often
added pipes in wrong places.
To enable the functionality you need to enable onTypeFormatting inside your
editor if it's not enabled by default.
In Visual Studio Code this needs to be done in settings by checking
Editor: Format On Type:
You will also need the newest version of the Visual Studio Code plugin.
There is still some possible improvements in case of copy pasting entire text
fragments, but that needs some more work.
Big thanks to another of our first time contributors from VirtusLab Karolina
Bogacka! Great work! 🎉
Add support for Scala 2.12.9
Metals now supports Scala 2.12.9! No new Scala version has been deprecated in
this release, since it is possible that Scala 2.12.10 version with some
important fixes will be released soon.
Big thanks to @gabro for again leading the effort!
This took considerably more time and effort than expected.
Miscellaneous fixes
erroneous warning for Scala 2.11 is no longer displayed
don't infer build target for non-readonly files
fix several small issues in the tree view protocol spec
set h2.bindAddress to avoid exposing open ports (thanks @blast-hardcheese!)
resolve symlinks that are used within workspaces
fix issues when import was requested multiple times without any change
detect openjdk as a valid jdk home
warn when java sources were not found
string interpolation completions now work properly in multiline string
add ReloadDoctor to the list of all commands (thanks @kurnevsky!)
add correct mill version in the predef script when running bloopInstall
SemanticDB plugin issues are no longer reported in java only projects
check if SeamnticDB really exists and only report issue when it doesn't
update default scalafmt to 2.0.1
use recommended version for build tools in UI message
fix file leak when importing large Gradle workspaces
Contributors
Big thanks to everybody who contributed to this release, a lot more people
joined this time to make the release better!
We are excited to announce the release of Metals v0.7.0 - codename "Thorium" 🎉
The release includes several new features along with bug fixes.
Metals is a language server for Scala that works with VS Code, Atom, Vim,
Sublime Text and Emacs. Metals is developed at the
Scala Center and VirtusLab
along with contributors from the community.
There is now a new "Metals" sidebar in VS Code that contains three tree views:
Build: overview of the build state, with buttons to manually trigger build
import.
Compile: overview of ongoing compilations, with buttons to manually cascade
compilation and cancel ongoing compilation.
Help and feedback: buttons to automate troubleshooting Metals issues and links
to relevant online resources such as GitHub, Gitter and Twitter.
Projects explorer
Libraries explorer
Browse symbols that are defined in jars of library dependencies.
Reveal active file in Metals side bar
There is a new command "Reveal active file in Metals side bar" that focuses the
library and project explorer to the current open file.
Compilation explorer
Get an overview of all compilations that are ongoing in the build. Previously,
only a single compilation progress was reported through the status bar.
Help and feedback explorer
Support for Scala 2.13
Metals now supports Scala 2.13.0! Please upgrade to Scalafmt v2.0.0 in order to
format 2.13-specific syntax such as underscore separators (1_000_000). Note
that completions may in rare situations not work perfectly for Scala 2.13, in
particular:
whitebox string interpolator macros, we had to disable one unit test for 2.13.
See #777.
better-monadic-for compile plugin, we had to disable one unit test for 2.13.
See #777.
Big thanks to @er1c for pushing for the effort on
both the Bloop and Metals side to support Java 11!
Improved classpath indexing performance
Previously, to support fuzzy symbol search Metals indexed classpath elements
using an algorithm that required a quadratic iteration on the number of
characters in classfile names. Now, the fuzzy symbol search algorithm only
requires a linear pass on the characters of a classfile name. This optimization
resulted in a 2x speedup for indexing a 235Mb classpath in our benchmarks.
Benchmark Mode Cnt Score Error Units
- ClasspathIndexingBench.run ss 10 1809.068 ± 61.461 ms/op # JDK 8+ ClasspathIndexingBench.run ss 10 919.237 ± 42.827 ms/op # JDK 8+ ClasspathIndexingBench.run ss 10 1316.451 ± 22.595 ms/op # JDK 11
Fallback to "find references" from "goto definition"
Previously, nothing happened when invoking "goto definition" on the symbol
definition itself. Now, Metals falls back to "find references" in this
situation.
Big thanks to @tanishiking for contributing
this new feature!
Dropping older Scala versions
The Scala versions supported by Metals are now the following.
Version
Old Status
New Status
2.11.9
Deprecated
Dropped
2.11.10
Deprecated
Dropped
2.11.11
Deprecated
Dropped
2.11.12
Supported
Deprecated, with no plans to be dropped in upcoming releases*
2.12.4
Deprecated
Dropped
2.12.5
Deprecated
Dropped
2.12.6
Deprecated
Dropped
2.12.7
Supported
Deprecated, please upgrade to 2.12.8
2.12.8
Supported
Supported
2.13.0
Unsupported
Supported
* Scala 2.11 support will likely stay around for a while given the situation
with Spark, Scala Native, Playframework and other libraries and frameworks that
have been late to adopt 2.12. Our download numbers show that ~10% of Metals
users are still on 2.11. Nevertheless, we encourage our users to upgrade to 2.12
to enjoy a better code editing experience thanks to multiple improvements in the
compiler.
Fixes for auto importing builds
digest only .sbt files at workspace level for sbt projects (thanks
@wojciechUrbanski!)
fix SemanticDB plugin path on Windows for Gradle workspaces
update default Mill version to 0.4.1 to fix an issue with classpath not
containing Scala library
Metals now pick up the version from .mill-version for the millw script
No more "work in progress"
Previously, the Metals website used the "Work-in-progress language server for
Scala" tagline to reflect the experimental status of the project. Now, the
tagline on the website has been changed to "Scala language server with rich IDE
features" to reflect that Metals is used by thousands of developers today for
their day-to-day coding.
Miscellaneous fixes
fix off-by-one for parameter hints when the cursor was after the closing )
parenthesis
make sure we add an autoimport in the correct line in case of brackets
document symbol outline no longer fails when val _ = () is the only thing in
a block expression
nested objects are now imported correctly in case of deeper nesting
fix concurrent modification in text document cache (thanks
@chikei!)
Contributors
Big thanks to everybody who contributed to this release, it's amazing we had a
couple of new contributors to Metals!
We are excited to announce the release of Metals v0.6.1, codename "Radium" 🎉
The release mostly focused on adding support for the build tools Gradle, Maven
and Mill.
Metals is a language server for Scala that works with VS Code, Atom, Vim,
Sublime Text and Emacs. Metals is developed at the
Scala Center along with contributors from the
community.
Metals now depends on Bloop v1.3.2 instead of v1.2.5. The v1.3 release of Bloop
has a ton of nice improvements that benefit Metals users. For full details, see
the
Bloop v1.3.0 release notes.
Automatic "import build" for Gradle, Maven and Mill
Now, it's possible to use Metals with the build tools Gradle, Maven and Mill!
Importing a build with Gradle, Maven and Mill now works the same way it works
for sbt.
For more details, see the corresponding documentation for each build tool:
An issue where the Metals process could continue running even after closing the
editor has now been fixed.
Completions freeze less
An issue where Metals could get stuck in an infinite loop using 100% CPU while
responding to completions has now been fixed.
Keyword completions
Previously, Metals did not complete keywords like import, new, lazy val or
trait. Language keywords are now included in the auto-completions in most
cases.
objectMain{
// Before
impo<COMPLETE>
// Afterimport
}
Keywords are suggested based on the context (e.g. you won't see throw suggested
if the cursor is not inside a declaration)
The only keywords that are not completed are: extends, finally, with,
forSome, catch and finally.
VS Code doesn't compile projects until it is focused
Previously, Metals would trigger compilation in the background even if the VS
Code window was not focused. For example, switching git branches in a separate
terminal window would still trigger compilation in Metals. Now, Metals waits
until the VS Code window is focused to trigger compilation.
This feature is implemented as a LSP extension and is currently only supported
by VS Code. For details on how to implement this extension for another editor,
see the
documentation on integrating a new text editor.
Metals is now a default server in the Sublime LSP package
Metals is now a default server for Scala source files in the LSP package, see
tomv564/LSP#571. This greatly
simplifies the installation steps for Sublime Text users.
Contributors
Big thanks to everybody who contributed to this release!
This release introduces minor improvements and bug fixes with highlights
including:
auto-imports are inserted at the toplevel instead of locally
document symbol lists inner methods and anonymous classes
the recommended Vim client is now coc.nvim
diagnostics are cleared for deleted files
fuzzy symbol search no longer returns results for deleted files
find all references now handles synthetic update calls
deprecate older Scala versions
Metals is a language server for Scala that works with VS Code, Atom, Vim,
Sublime Text and Emacs. Metals is developed at the
Scala Center along with contributors from the
community.
Now, the import is inserted at the toplevel instead
import scala.concurrent.Future// <- automatically added by MetalsobjectMain{
val future = Future@@
}
Document symbols now shows inner methods and anonymous classes
Before:
After:
Diagnostics gracefully handle deleted files
Previously, deleting a file with compile errors would result in the stale
diagnostics to stay until you restarted the Metals server. Now, diagnostics are
cleared when a source file is deleted.
Fuzzy symbol search gracefully handles deleted files
Previously, fuzzy searching for a symbol could return results from deleted
files. Now, fuzzy symbol search only shows results from files that exist on
disk.
Find all references handles synthetic update calls
Previously, find all references did not catch references where an update()
method call was synthesized.
val cache = mutable.Map.empty[String, String]
cache("a") = "b"// before: referenced `Map.update()` instead of `cache`
Now, the reference to cache in cache("a") = "b" is indexed as well as the
synthetic call to the Map.update() method.
The recommended Vim client is now coc.nvim
Previously, the
vim installation instructions
recommended the vim-lsc client. Now, the installation instructions recommend
coc.vim since it supports more functionality of the Language Server Protocol. If
you use Vim, we recommend trying out coc.vim to enjoy more advanced features
like completions with auto-imports.
Deprecate older Scala versions
Metals works with Scala 2.11 and Scala 2.12. Starting from the next release,
Metals will drop support for the older patch versions of those series, and it
will exclusively support these version:
2.11.12
2.12.7
2.12.8
Starting from this release, we will show a warning at startup if you're using an
outdated Scala version, prompting you to upgrade your project to the latest
version.
Contributors
Big thanks to everybody who contributed to this release!
We are excited to announce the release of Metals v0.5, codename "Mercury" 🎉
This release introduces new features, performance improvements and bug fixes
with highlights including:
code completions
parameter hints
show type at point
code folding
document highlight
Metals is a language server for Scala that works with VS Code, Atom, Vim,
Sublime Text and Emacs. Metals is developed at the
Scala Center along with contributors from the
community.
It's now possible to use code completions to explore APIs, implement interfaces,
generate exhaustive pattern matches and more.
Auto-import: symbols that are not in scope are automatically imported
locally. Imports still need to be organized manually, we are exploring ways to
automate this workflow in the future.
Override def: implement methods from the super class.
Exhaustive match: generate an exhaustive pattern match for sealed types.
String interpolator: automatically convert string literals into string
interpolators.
Filename: complete classnames based on the enclosing file.
Documentation: read the docstring for method symbols by pressing
ctrl+space in VS Code.
Hover (aka. type at point)
It's now possible to see the expression type and symbol signature under the
cursor.
Expression type: shows the non-generic type of the highlighted expression.
Symbol signature: shows the generic signature of symbol under the cursor
along with its docstring, if available.
Signature help (aka. parameter hints)
It's now possible to view a method signature and overloads as you fill in
arguments.
Code folding
It's now possible to fold ranges such as large expressions, import groups and
comments.
Big thanks to @marek1840 for contributing this
feature!
Document highlight
It's now possible to highlight references to the same symbol in the open file.
Big thanks to @tgodzik for contributing this
feature!
Faster and more relevant fuzzy symbol search
Previously, fuzzy symbol search (workspace/symbol in LSP) always returned
results from both the workspace and library dependencies. Now, fuzzy symbol
search returns only results from the workspace unless the query contains a
semicolon character ;. For example:
query "Future": workspace only, with fallback to library dependencies if
workspace contains 0 results
queries "Future;" or ";Future" or "Fut;ure": workspace + library dependencies.
This change improves the quality for the search results since most often you
want to navigate to symbols defined in the workspace. A nice side-effect is that
workspace-only searches are faster because we avoid redundant work by not
looking at library dependencies.
In addition, this release introduces a new in-memory index for workspace-only
symbol queries resulting in even better performance compared to the last
release.
Goto definition for in-memory edits
Previously, goto definition worked only for identifiers that had been saved and
successfully compiled in the build tool. Now, you can use goto definition for
symbols that you just typed even if the source file hasn't been saved or
contains type errors.
Standalone Scala files outside a build tool
Previously, semantic features like goto definition worked only for sources that
belong to a build project. Now, Metals provides completions, parameter hints,
hover and definition for local symbols in standalone Scala files. The classpath
for standalone Scala files includes the JDK and the Scala standard library so
features like completion will not understand symbols from external library
dependencies.
Known limitation: only syntax errors are published for standalone Scala
files, the file must belong to a build in order to see type errors.
New collaboration with VirtusLab
As part of a new collaboration between VirtusLab and
the Scala Center, Marek Żarnowski (@marek1840)
and Tomasz Godzik (@tgodzik) will be contributing
to Metals development for the coming months. They have already contributed
several impressive pull requests:
textDocument/foldingRange(#632): code folding that
understands Scala syntax.
textDocument/documentHighlight(#621): highlight occurrences
of a symbol in the current file.
textDocument/completion(#640): override def
completions from without the need to type "override def ".
It is our pleasure to welcome them to the team and we look forward to working
together with them to improve the Scala editing experience :)
Contributors
Big thanks to everybody who contributed to this release! In particular, big
thanks to @jvican and
@gabro for invaluable feedback both online and
offline.
Metals is a language server for Scala that works with VS Code, Atom, Vim,
Sublime Text and Emacs. Metals is developed at the
Scala Center along with contributors from the
community.
We are excited to announce the release of Metals v0.4, codename "Tin" 🎉 Metals
is a language server for Scala that works with VS Code, Atom, Vim, Sublime Text
and Emacs. Metals is developed at the Scala Center
with contributors from the community.
The latest Metals release introduces three new in-memory indexes to implement
the features "find symbol references" and "fuzzy symbol search". Indexes are
important to provide fast response times for user requests but they come at the
price of higher memory usage. To keep memory usage low, Metals uses a data
structure called bloom filters that implements space-efficient sets. Thanks to
bloom filters, the three new indexes added in the last release use only a few
megabytes of memory even for large projects with >500k lines of code.
In this post, we look into how Metals uses bloom filters for fast indexing with
small memory footprint. We explain what bloom filters are and how we can encode
problems like fuzzy searching to take advantage of the nice properties of bloom
filters. Finally, we evaluate these new features on a real-world project: the
Akka build.