Metals

Metals

  • Docs
  • Blog
  • GitHub

›All Blog Posts

All Blog Posts

  • Metals v0.7.6 - Thorium
  • Metals v0.7.5 - Thorium
  • Metals v0.7.2 - Thorium
  • Metals v0.7.0 - Thorium
  • Metals v0.6.1 - Radium
  • Metals v0.5.1
  • Metals v0.5.0
  • Metals v0.4.4
  • Metals v0.4.0
  • Low-memory symbol indexing with bloom filters
  • Metals v0.3.2
  • Fast goto definition with low memory footprint
  • Metals v0.3 - Iron

Metals v0.7.6 - Thorium

September 23, 2019

Tomasz Godzik

Tomasz Godzik

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.

In this release we merged 11 PRs and closed 5 issues, full details: https://github.com/scalameta/metals/milestone/18?closed=1

TL;DR

Check out the website and give Metals a try: https://scalameta.org/metals/

  • add support for Scala 2.12.10 and 2.13.1
  • formatting on paste for multiline strings
  • fixes for autofill feature

Add support for Scala 2.12.10 and 2.13.1

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:

format-on-paste

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:

format-on-paste

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

Merged PRs

v0.7.6 (2019-09-23)

Full Changelog

Merged pull requests:

  • replace java streams with generators #938 (marek1840)
  • ENSIME is not an alternative #936 (fommil)
  • Swap field to type parameter for scala Type #933 (tgodzik)
  • Refactor autofill option #932 (tgodzik)
  • Make sure we continue searching for symbols in try. #930 (tgodzik)
  • Disable flaky test. #918 (olafurpg)
  • Fix indentation when adding pipes in multiline string. #922 (tgodzik)
  • Remove dealias to properly support type #921 (tgodzik)
  • Simplify testing when calculating position and automatically add pipes when copy pasting input #919 (tgodzik)
  • Add Scala 2.12.10 support and use 2.12.10 on Metals #913 (gabro)
  • Update isCompiled status of the build target regardless of the compilation result #907 (marek1840)

Metals v0.7.5 - Thorium

September 12, 2019

Tomasz Godzik

Tomasz Godzik

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.

In this release we merged 12 PRs and closed 6 issues, full details: https://github.com/scalameta/metals/milestone/17?closed=1

TL;DR

Check out the website and give Metals a try: https://scalameta.org/metals/

  • add auto-fill option to case classes
  • deduce values for named parameters completions
  • 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.

auto-fill

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.

deduce

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!

$ git shortlog -sn --no-merges v0.7.2..v0.7.5
Tomasz Godzik
Gabriele Petronella
Łukasz Byczyński
Olafur Pall Geirsson

Merged PRs

v0.7.5 (2019-09-12)

Full Changelog

Merged pull requests:

  • Revert sbt version to 1.2.8 #915 (tgodzik)
  • Upgrade to latest sbt-sonatype for faster and more stable releases #912 (olafurpg)
  • Update with new Eclipse capabilities #911 (mundacho)
  • Check for stripMargin when adding | #904 (tgodzik)
  • Add additional tips & tricks to the sublime text documentation #906 (LukaszByczynski)
  • Update sbt to 1.3.0 #905 (gabro)
  • Fix more possible presentation compiler classpath issues #901 (tgodzik)
  • Update Mill to 0.5.1 #899 (tgodzik)
  • Update website overview and add information about Eclipse #894 (tgodzik)
  • Retry with clean compiler after ShutdownReq #898 (tgodzik)
  • Add automatic value completions on named arguments #827 (tgodzik)
  • Fix links to merged PRs in blogpost #896 (tgodzik)
  • Add release notes for v0.7.2 #886 (tgodzik)

Metals v0.7.2 - Thorium

September 2, 2019

Tomasz Godzik

Tomasz Godzik

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.

In this release we merged 39 PRs and closed 11 issues, full details: https://github.com/scalameta/metals/milestone/14?closed=1

TL;DR

Check out the website and give Metals a try: https://scalameta.org/metals/

  • support for Scala 2.12.9
  • fix completions in case of inline comments
  • add support for non-directory sources
  • 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:

val List(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.

add-package

We also added support for package objects. Whenever you create package.scala file, we will automatically create the barebone definition of the package object.

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.

pipes

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:

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!

$ git shortlog -sn --no-merges v0.7.0..v0.7.2
Gabriele Petronella
Tomasz Godzik
Ólafur Páll Geirsson
Evgeny Kurnevsky
Marek Żarnowski
Lucas Satabin
Ayoub Benali
Chris Birchall
Compro Prasad
Devon Stewart
Jesús Martínez
Karolina Bogacka
Tomasz Dudzik
Chris Kipp
Rikito Taniguchi

Merged PRs

v0.7.2 (2019-08-29)

Full Changelog

Merged pull requests:

  • Fix not closing streams when using Files.list #892 (tgodzik)
  • Avoid file leaks when digesting Gradle builds #889 (olafurpg)
  • Fix broken tests #888 (olafurpg)
  • Bump Metals Scala version to 2.12.9 #887 (tgodzik)
  • Add check mark for formatting under vim #885 (satabin)
  • Recommend a recent version of the build tool when incompatible or unknown #881 (gabro)
  • Use BuildInfo.scalaCompilerVersion over Properties.versionNumberString #876 (olafurpg)
  • Remove use of early intializers #877 (gabro)
  • Catch ShutdownReq exception from stopping a presentation compiler. #873 (olafurpg)
  • Transpose features/editors table #875 (gabro)
  • Make presentation compiler work on 2.12.9 #872 (gabro)
  • Scala 2.12.9 support #867 (gabro)
  • Automatically add package objects when creating package.scala file #866 (tgodzik)
  • Automatically add package declaration when creating a file #862 (tdudzik)
  • Fix TreeViewSlowSuite tests #864 (gabro)
  • Update scalafmt to 2.0.1 #863 (tanishiking)
  • Add support for non-directory sources #857 (tgodzik)
  • Report an issue only if SemanticDB file doesn't really exist. #853 (tgodzik)
  • Do not report issues in Java only projects #850 (tgodzik)
  • Emacs supports client commands now #848 (kurnevsky)
  • Fix issue if exact query is longer than the class name #843 (tgodzik)
  • Fix issue with wrong mill version in predef script and update millw scripts #842 (tgodzik)
  • Fix Mercury blog post date by adding an unlisted redirect #836 (gabro)
  • Update sublime doc regarding autoimport #839 (ayoub-benali)
  • Improve handling of the java sources #825 (marek1840)
  • Add exact libraries that are expected and fix the test #837 (tgodzik)
  • Add ReloadDoctor to the list of all commands. #830 (kurnevsky)
  • Install use-package if not already installed #828 (Compro-Prasad)
  • Fix multiline edits #826 (tgodzik)
  • Timestamps should use currentTimeMillis #822 (tgodzik)
  • resolve symlinks from client requests #824 (marek1840)
  • Setting h2.bindAddress to avoid exposing open ports #821 (blast-hardcheese)
  • Use Scalafmt 2.0.0 when setting the version in .scalafmt.conf #806 (gabro)
  • Don't infer build target for non-readonly files. #810 (olafurpg)
  • Fix versions in docs - wrong number of @ was used #820 (tgodzik)
  • Update the list of supported Scala binary versions #818 (cb372)
  • Bump mill version #817 (satabin)
  • Send treeViewDidChange only when the client supports it #816 (kurnevsky)
  • Fix issue with missing completions after comment and newline. #814 (tgodzik)
  • Fix several issues in the tree view protocol spec #811 (olafurpg)
  • Make test-release.sh script check that artifacts have synced to Maven #812 (olafurpg)
  • nvim version and updated info about required java versions #807 (ckipp01)
  • Lost a word in the last PR and adding it now #805 (tgodzik)
  • Use sonatype:public in our own meta build #803 (gabro)
  • Fix an issue with wrong deprecation warning for 2.11 and update snapshot version #804 (tgodzik)
  • Fix version typo #802 (JesusMtnez)

Metals v0.7.0 - Thorium

June 28, 2019

Ólafur Páll Geirsson

Ólafur Páll Geirsson

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.

In this release we merged 21 PRs and closed 8 issues, full details: https://github.com/scalameta/metals/milestone/11?closed=1

TL;DR

  • New tree view in VS Code
  • New support for Scala 2.13
  • New support for JDK 11
  • New improved classpath indexing performance
  • New fallback to "find references" when calling "goto definition" on a symbol definition
  • Bug fixes for importing builds in Gradle, Mill and sbt
  • Dropped support for deprecated Scala versions 2.11.9, 2.11.10, 2.11.11, 2.12.4, 2.12.5 and 2.12.6.

Check out the website and give Metals a try: https://scalameta.org/metals/

Tree views in VS Code

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

2019-06-26 20 28 14

Libraries explorer

Browse symbols that are defined in jars of library dependencies.

2019-06-26 20 28 51

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.

2019-06-27 16 02 33

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.

2019-06-23 15 41 07

Help and feedback explorer

Screenshot 2019-06-27 at 15 57 15

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 @gabro for leading this effort!

JDK 11 support

Metals can now run on Java 11! To use Java 11 instead of Java 8, point the $JAVA_HOME environment variable to a Java 11 installation.

The VS Code extension will continue to use Java 8 by default, update the "Java Home" setting to use Java 11 instead.

To obtain the Java 11 home on macOS, use the following command:

$ /usr/libexec/java_home 11
/Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home

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.

Fallback

Big thanks to @tanishiking for contributing this new feature!

Dropping older Scala versions

The Scala versions supported by Metals are now the following.

VersionOld StatusNew Status
2.11.9DeprecatedDropped
2.11.10DeprecatedDropped
2.11.11DeprecatedDropped
2.11.12SupportedDeprecated, with no plans to be dropped in upcoming releases*
2.12.4DeprecatedDropped
2.12.5DeprecatedDropped
2.12.6DeprecatedDropped
2.12.7SupportedDeprecated, please upgrade to 2.12.8
2.12.8SupportedSupported
2.13.0UnsupportedSupported

* 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!

$ git shortlog -sn --no-merges v0.6.1..v0.7.0
Gabriele Petronella
Ólafur Páll Geirsson
Tomasz Godzik
Eric Peters
tanishiking
Ruben Berenguel
TzeKei Lee
Wojciech Urbanski

Merged PRs

v0.7.0 (2019-06-28)

Full Changelog

Merged pull requests:

  • Upgrade to Scalameta v4.2.0 #799 (olafurpg)
  • Introduce Tree View Protocol #797 (olafurpg)
  • Add a benchmark for classpath indexing performance. #795 (olafurpg)
  • Migrate Java converters to 2.13 #794 (gabro)
  • Remove dot as a commit character #793 (tgodzik)
  • Make classpath indexing linear instead of quadratic. #792 (olafurpg)
  • Use 2.13 dialect for syntax errors #789 (gabro)
  • Fix off-by-one for parameter hints. #786 (olafurpg)
  • Make sure we add an autoimport in the correct line #785 (tgodzik)
  • Fix typo #784 (tanishiking)
  • Remove Work-in-progress from the tagline #782 (gabro)
  • Fix JdkSources not to ignore JAVA_HOME environment variable #781 (tanishiking)
  • Fix importing nested objects #778 (tgodzik)
  • Fix an issue when val \_ = \(\) is the only thing in the block #776 (tgodzik)
  • Fallback to "show usages" from "Goto definition" if the symbol represents a definition itself #775 (tanishiking)
  • Move slow tests to separate directories and run them separately on Travis #773 (tgodzik)
  • Digest only sbt files at workspace level #772 (wojciechUrbanski)
  • Fix wrong windows SemanticDB file path #771 (tgodzik)
  • Fix concurrent modification #766 (chikei)
  • Factor out a ClasspathLoader.getURLs(classLoader) helper for java9+ compatability, update usages #765 (er1c)
  • Include mill version from .mill-version file #764 (tgodzik)
  • Add 2.13 support and drop deprecated versions #763 (gabro)
  • Clarifiyng a setting #759 (rberenguel)
  • Fix very small typo in docs #758 (rberenguel)
  • Fix completions to compilation in blog #757 (tgodzik)
  • Update VS Code docs #756 (tgodzik)
  • Add release notes for Metals Radium release #752 (tgodzik)

Metals v0.6.1 - Radium

June 11, 2019

Tomasz Godzik

Tomasz Godzik

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.

In this release we merged 24 PRs and closed 6 issues, full details: https://github.com/scalameta/metals/milestone/7?closed=1.

TL;DR

  • automatic "import build" for Gradle, Maven and Mill
  • upgraded to Bloop v1.3.2
  • better handling of requests that access the presentation compiler
  • code completions on keywords
  • VS Code doesn't compile projects until it is focused
  • Metals is now a default server in the Sublime LSP package

Check out the website and give Metals a try: https://scalameta.org/metals/

Bloop upgrade

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:

  • Overview
  • Gradle
  • Maven
  • Mill

More reliable shutdown

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.

object Main {
    // Before
    impo<COMPLETE>
    // After
    import
}

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!

$ git shortlog -sn --no-merges v0.5.1..v0.6.1
Ólafur Páll Geirsson
Adam Gajek
Tomasz Godzik
Gabriele Petronella
Ayoub Benali
Cody Allen
Evgeny Kurnevsky
Jeffrey Lau
Marek Żarnowski
Markus Hauck
German Greiner

Merged PRs

  • Avoid inifinite loop when shortening types #751 (olafurpg)
  • Move releasing info to the website #748 (gabro)
  • Update bloop to 1.3.2 #747 (tgodzik)
  • Split build tool and executable name to show properly in output #746 (tgodzik)
  • Update bloop to 1.3.0 and BSP to 2.0.0-M4 #745 (tgodzik)
  • Add better hint in the doctor for Maven workspaces #744 (tgodzik)
  • Update emacs docs as scala is supported by lsp-mode directly now #741 (kurnevsky)
  • Remove Scalafix from pre-push git hook. #740 (olafurpg)
  • Setup git hooks for scalafmt and scalafix. #738 (olafurpg)
  • Add automatic Mill import to metals #737 (tgodzik)
  • Improve handling of requests that access the presentation compiler. #736 (olafurpg)
  • Enforce scala version for embedded bloop server #735 (tgodzik)
  • Ensure build server shuts down before starting new build connection. #731 (olafurpg)
  • Fix blogpost typo #730 (zoonfafer)
  • Miscellaneous polish fixes #729 (olafurpg)
  • Implement textDocument/codeLens to run main function #728 (marek1840)
  • Fix newlines in process output. #727 (tgodzik)
  • Update sublime doc #726 (ayoub-benali)
  • Fix transitive scala library dependency in Gradle builds. #725 (tgodzik)
  • Adds maven integration to metals #722 (tgodzik)
  • Use CocRequestAsync in Vim docs #717 (ceedubs)
  • Set timeout for shutdown procedure, fixes #715. #716 (olafurpg)
  • Add keyword completion #712 (markus1189)
  • Make bloop versions customizable via server properties. #710 (olafurpg)
  • Pause compile-on-save while the editor window is not focused #709 (agajek)
  • Add gradle support to imports in metals and refactor build tool support. #694 (tgodzik)

Metals v0.5.1

April 26, 2019

Ólafur Páll Geirsson

Ólafur Páll Geirsson

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.

In this release we merged 15 PRs and closed 7 issues, full details: https://github.com/scalameta/metals/milestone/8?closed=1.

Automatic imports are placed globally instead of locally

Previously, auto-imports were placed locally like this:

object Main {
  import scala.concurrent.Future // <- automatically added by Metals
  val future = Future@@
}

Now, the import is inserted at the toplevel instead

import scala.concurrent.Future // <- automatically added by Metals

object Main {
  val future = Future@@
}

Document symbols now shows inner methods and anonymous classes

Before:

image

After:

image

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!

$ git shortlog -sn --no-merges v0.5.0..v0.5.1
Ólafur Páll Geirsson
Gabriele Petronella
Gabriel Volpe
JesusMtnez
Eric Peters
Arnout Engelen
Robin Green
Tomasz Godzik
David Strawn

Merged PRs

  • Upgrade to latest Scalameta. #702 (olafurpg)
  • Add question template #701 (gabro)
  • Don't return workspace/symbol results for deleted files. #695 (olafurpg)
  • Insert global imports instead of local imports. #692 (olafurpg)
  • Fix a dead link to Bloop site #691 (gabro)
  • Update a couple .lines to .linesIterator for java11 #688 (er1c)
  • Fix typo #687 (greenrd)
  • Handle document symbols for nested declarations #686 (gabro)
  • Update Emacs docs #681 (JesusMtnez)
  • Add "Coming from IntelliJ" section to VS Code docs. #678 (olafurpg)
  • Clear diagnostics on build import, fixes #644. #677 (olafurpg)
  • Disable flaky test on Appveyor. #676 (olafurpg)
  • Update stable version in issue template #671 (gabro)
  • Documenting coc.nvim as the recommended LSP client for Vim #665 (gvolpe)
  • Remove Deprecated Usage Of java.util.Date API #663 (isomarcte)
  • Link to vscode marketplace #661 (raboof)
  • Use correct GIF for signature help on landing page. #660 (olafurpg)
  • Document new features and write release announcement. #655 (olafurpg)
  • Make detail view in override not show unicode character. #654 (tgodzik)

Metals v0.5.0

April 12, 2019

Ólafur Páll Geirsson

Ólafur Páll Geirsson

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.

In this milestone we merged 76 PRs and closed 26 issues, full details: https://github.com/scalameta/metals/milestone/4?closed=1.

Code completions

It's now possible to use code completions to explore APIs, implement interfaces, generate exhaustive pattern matches and more.

2019-04-12 14 19 39

  • 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.

$ git shortlog -sn --no-merges v0.4.4..v0.5.0
Ólafur Páll Geirsson
Marek Żarnowski
Johan Muedsam
JesusMtnez
Tomasz Godzik
Tim Nieradzik
Ayoub Benali
Eric Peters
Alexey Alekhin
keiSunagawa

Merged PRs

  • Implement goto definition fallback with the presentation compiler. #645 (olafurpg)
  • Generate exhaustive pattern match for sealed types. #643 (olafurpg)
  • Improve quality and performance of workspace/symbol, fixes #639. #642 (olafurpg)
  • Enable workspace query to match package object #641 (mudsam)
  • Make completions work on overr<COMPLETE> and def<COMPLETE> #640 (tgodzik)
  • Give CompletionPosition finer control over sorting, fixes #619. #638 (olafurpg)
  • Several UX improvements #637 (olafurpg)
  • Use fallback presentation compiler for missing build target. #634 (olafurpg)
  • Fix six bugs #633 (olafurpg)
  • Implement textDocument/foldingRange #632 (marek1840)
  • Provide fuzzier type member matching and more polished sorting. #629 (olafurpg)
  • Sort symbols defined in the current file to the top, fixes #618. #628 (olafurpg)
  • Render @see as links. Improve inline link handling and update test cases. #627 (mudsam)
  • Disable macro-paradise compiler plugin, fixes #622. #625 (olafurpg)
  • Improve completion snippets, fixes #610. #623 (olafurpg)
  • Implement textDocument/documentHighlight #621 (tgodzik)
  • Handle exceptions when computing completion position. #616 (olafurpg)
  • Don't eagerly load presentation compiler during tests. #614 (olafurpg)
  • Eagerly load presentation compiler for open buffers. #605 (olafurpg)
  • Eagerly load Scalafmt during initialized #604 (olafurpg)
  • Complete filename when defining toplevel class/trait/object #603 (olafurpg)
  • Remove signature help fallback in hover. #602 (olafurpg)
  • Fix #599, don't insert import above generated parameter accessors #600 (olafurpg)
  • Several small fixes #597 (olafurpg)
  • Support navigation for library dependencies in Scala versions. #596 (olafurpg)
  • Implement hover (aka. type at point). #595 (olafurpg)
  • Fix auto-import position around definition annotations, fixes #593 #594 (olafurpg)
  • Provide completions on case for valid subclasses. #592 (olafurpg)
  • Polish snippets when completing with existing parentheses and braces #590 (olafurpg)
  • Handle generic unapply signatures in signature help. #589 (olafurpg)
  • Explicitly set filter text for all completions. #588 (olafurpg)
  • Add server property config to disable features. #587 (olafurpg)
  • Add support for non-Lightbend compilers #586 (tindzk)
  • Fix signature help bug for tuple patterns. #585 (olafurpg)
  • Escape keyword identifier in packag prefixes. #584 (olafurpg)
  • Filter out ensuring and -> extension methods from Predef. #583 (olafurpg)
  • Include method signature in completion item label. #581 (olafurpg)
  • Two completion improvements #579 (olafurpg)
  • Insert local import when completing workspace symbol. #578 (olafurpg)
  • Update Sublime Text doc regarding Goto symbol in workspace #577 (ayoub-benali)
  • Include case completion when writing partial function on tuples. #576 (olafurpg)
  • Restart the presentation compile more aggressively. #575 (olafurpg)
  • Fix #573, provide unique filter text for each interpolator completion item #574 (olafurpg)
  • Fix #569, remove completion items with \_CURSOR\_ name. #572 (olafurpg)
  • Implement override def completions. #570 (olafurpg)
  • Make bloop server startup more robust, reuse sockets wherever possible. #566 (mudsam)
  • Implement type member selection in string interpolators. #563 (olafurpg)
  • Update Atom info #561 (laughedelic)
  • Improve string interpolator completions #560 (olafurpg)
  • Remove root package from completion results. #559 (olafurpg)
  • Resolve mtags from Sonatype Snapshots, fixes #554. #558 (olafurpg)
  • Disable \( as commit character. #557 (olafurpg)
  • Wrap identifiers in backticks when necessary. #556 (olafurpg)
  • Trigger parameter hints command after completion, if supported. #552 (olafurpg)
  • Cross-publish mtags for all supported Scala versions. #541 (olafurpg)
  • Implement completions and signature help. #527 (olafurpg)

Metals v0.4.4

February 1, 2019

Ólafur Páll Geirsson

Ólafur Páll Geirsson

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.

Read More

Metals v0.4.0

January 24, 2019

Ólafur Páll Geirsson

Ólafur Páll Geirsson

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.

Read More

Low-memory symbol indexing with bloom filters

January 22, 2019

Ólafur Páll Geirsson

Ólafur Páll Geirsson

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.

Read More
Next →
Metals
Overview
Text EditorsBuild ToolsProject GoalsContributing
Editors
Visual Studio CodeAtomVimSublime TextEmacsEclipse
Social
Copyright © 2019 Metals