We're happy to announce the release of Metals v0.9.1, which focused on fixing issues with the recently released Scala 3 support, Ammonite support and a couple of new features.
|Commits since last release||287|
For full details: https://github.com/scalameta/metals/milestone/24?closed=1
Metals is a language server for Scala that works with VS Code, Vim, Emacs, Sublime Text, Atom and Eclipse. Metals is developed at the Scala Center and VirtusLab with the help from Lunatech along with contributors from the community.
Check out https://scalameta.org/metals/, and give Metals a try!
- Ammonite support
- New project provider
- Worksheet dependency support
- Multiline string improvements
- Scala versions 2.13.3, 0.24.0, 0.25.0-RC2 support
- Dropped support for Scala 0.23.0 and deprecated the 0.24.0-RC1 version.
- Multiple build tool selection within a workspace
Thanks to great work by alexarchambault we now support Ammonite script files. Ammonite enables you to create scripts that can easily be ran from the command line, without the overhead of setting up a build tool while still allowing you to download and use dependencies.
The support includes most of the LSP features such as diagnostics, completions,
references, go to definition, but does not include running or debugging the
scripts. This new feature works by starting an additional Ammonite BSP server
that compiles the scripts and provides additional information about them such as
Scala version or information about the added dependencies. You can change the
default JVM parameters for the server such as
-Xmx, which will limit the used
memory in Metals settings. These can be added via your metals editor extension
using the newly created
metals.ammoniteJvmProperties setting. The Ammonite
server can also be started and stopped manually using the new commands
Each of the scripts first need to be imported into the Ammonite BSP server, which can be done manually by clicking on the pop up whenever a new script is opened or selecting automatic import at the start, which will import any open scripts automatically.
It's important to note that this is an early approach to Ammonite support, which might still require some improvements both on the Metals and Ammonite side. You can learn more about the new feature or join the discussion in the blogpost on the Scala contributors forum.
Some of the notable features of Ammonite scripts are:
- Import other scripts: Metals provides completions to select existing files based on the filesystem information
//main.sc import $file.hello-world val greeting = hello-world.greeting //hello-world.sc val greeting = "Hello world!"
- Import dependencies:
import $ivy.`com.lihaoyi::scalatags:0.7.0` import scalatags.Text.all._ val rendered = div("Moo").render
- Set Scala version:
// scala $scalaVersion import scala.util.Properties pprint.log(Properties.releaseVersion)
The Scala version is independent from any build tool used in the workspace and without specifying the exact version it will use the default Ammonite Scala version.
To learn more about Ammonite please visit the documentation website at https://ammonite.io.
Worksheet dependency support
In addition to Ammonite support, which will be useful to anyone interested in Scala scripting, we've also improved the support for Metals Scala worksheets. Thanks to the efforts of olafurpg in mdoc, which powers worksheets, users are now able to import dependencies directly inside of their Scala worksheet with completions and diagnostics working right from the start.
You can add them using the following syntax:
:: is the same as
%% in sbt, which will append the current Scala binary
version to the artifact name.
New project provider
Creating new Scala projects is usually a bit of work to get started, which is a problem for both beginners and experts alike. Normally you don't want to spend a lot of time figuring out the best setup for starting with a new technology or the language itself.
There are great tools like giter8, which
is used in the
sbt new command, that enables people to use already existing
Scala templates found on Github such as
The problem is when you don't use sbt or you don't know the exact template you
want to use.
To address this, we've added an additional command called
New Scala Project
that enables users to reuse the same mechanism from the comfort of your editor.
Firstly, you can choose from existing templates, either curated by the Metals
team, ones existing on the giter8
wiki page or
alternatively an entirely custom template. Then you can choose the exact
location for the new project and the name. Afterwards, Metals will run giter8 to
create the project and offer to open that new project.
The command is also available as a button in the welcome view of the Visual Studio Code Metals extension, which means it will be visible in case there are no imported projects in the current workspace.
The first curated templates were chosen by the team, however we are happy to include more so that it's easier for people to discover new amazing libraries or frameworks.
Multiline string improvements
There are two new quality of life improvements when it comes to multiline
strings. Firstly, thanks to mlachkar we now
stripMargin method invocation when using newline in a
multiline string if that string uses
| and has no existing
This behaviour can be disabled in Metals settings using
Another useful improvement coming from colineto
is a new code action that can easily convert single string into the traditional
multiline string with
stripMargin at the end:
Multiple workspace build tools selection
Previously, Metals would only pick up a single build tool in a workspace even if in reality there were multiple available ones. To help with that we added a prompt to choose the desired build tool in workspaces with multiple build files.
An example situation where this is needed is when you have a project with both a
build.sc, but the
build.sc is what you use for your build
definition. Previously if both were detected, it was automatically considered an
Sbt workspace, however now it's possible to choose.
In case of multiple build tools in single workspace you can see which one was used to import project in 'Metals Doctor' view. If you choose the wrong one, or change the main build tool later on, you'll need to remove the .metals/ directory to reset the decisions.
This great new feature was contributed by ckipp01!
- Fix run/debug in Maven workspaces.
- Always run newest sbt version if none is specified.
- Fix find references for Scala 3 on Windows.
- Pick jvm targets with higher priority when using run/debug without specifying the exact build target.
- Make breakpoints work properly in Scala 3 and in case of nested classes.
- Exhaustive pattern matching in the case of sealed upper bound types.
- Compile before renaming instead of showing an error.
- Fix issue with symlinked source directories.
- Fix missing references for synthetic companion objects.
- Automatically add -J if it doesn't already exist to java properties when running or debugging.
- Fix go to definition for JDK 11 library sources.
- Keep modifiers when implementing abstract members.
- Fix auto imports position when using package objects and multiple package definitions.
- Fix issues in files with Scala 2.13 specific syntax like for example
underscore numeric literals (
val num = 100_000).
- Always run Mill in interactive mode.
- Improvements to hover in Scala 3 files.
- Make sure auto imports are correct for Ammonite scripts
Big thanks to everybody who contributed to this release or reported an issue!
git shortlog -sn --no-merges v0.9.0..v0.9.1 Tomasz Godzik Scala Steward Alexandre Archambault Chris Kipp Trojanowski Coline Thomas Krzysztof Bochenek Meriam Lachkar bettyblue Daniel King Naoki Takezoe Olafur Pall Geirsson Win Wang Martin Duhem ag91 faizk Wawrzyk
Merged pull requests:
- Add support for Scala 2.13.3 #1857 (tgodzik)
- Update scalafmt-dynamic to 2.6.1 #1879 (scala-steward)
- Update sbt-mdoc to 2.2.3 #1878 (scala-steward)
- Update ipcsocket to 1.1.0 #1877 (scala-steward)
- Update sbt, scripted-plugin to 1.3.13 #1876 (scala-steward)
- Update flyway-core to 6.5.0 #1875 (scala-steward)
- Update jackson-databind to 2.11.1 #1873 (scala-steward)
- Ensure the edit positions are correct for autoImports with Ammonite. #1871 (ckipp01)
- Add in a preparePr alias. #1867 (ckipp01)
- Bump default mill version #1861 (ckipp01)
- Update mdoc to 2.2.3 and power completions with worksheet's classpath #1856 (tgodzik)
- Add jvm parameters configuration for Ammonite #1853 (tgodzik)
- Remove fastpass command line tool #1833 (olafurpg)
- Update Bloop to fix issues when using run/debug in Maven workspaces #1850 (tgodzik)
- Added completions for $file in ammonite scripts #1846 (tgodzik)
- Bump scalafmt up to 2.6.1 #1847 (ckipp01)
- In case of no defined sbt version run bloopInstall with the newest one #1843 (tgodzik)
- Bump up the scalafmt version for the codebase #1840 (ckipp01)
- Fix adding unmanaged source directories for mtags3 #1842 (tgodzik)
- Remove extra nested scala directory under
- Update dotty to 0.25.0-RC-2 and 0.24.0 #1839 (tgodzik)
- Add in explicit
TextDocumentSyncOptions. #1837 (ckipp01)
- Changes for decorationProvider if
isHttpEnabledis true. #1834 (ckipp01)
- Add in spacing in vscode icons only. #1832 (ckipp01)
- Update sbt-munit to 0.7.9 #1828 (scala-steward)
- Use g8 templates to provide "New Scala Project" #1728 (tgodzik)
- Update coursier to 2.0.0-RC6-21 #1822 (scala-steward)
- Mark ammonite suites flaky #1830 (tgodzik)
- Update flyway-core to 6.4.4 #1825 (scala-steward)
- Update undertow-core to 2.1.3.Final #1824 (scala-steward)
- Update sbt-native-packager to 1.7.3 #1821 (scala-steward)
- Update scalameta, semanticdb-scalac, ... to 4.3.15 #1829 (scala-steward)
- Update sbt-mdoc to 2.2.2 #1827 (scala-steward)
- Update ammonite-runner to 0.2.5 #1823 (scala-steward)
- Update sbt-scalafix to 0.9.17 #1820 (scala-steward)
- Update ammonite to fix issues with file watching #1819 (tgodzik)
- Fix issues with semanticdb on windows #1818 (tgodzik)
- Update directories to 12 #1813 (tgodzik)
- Pick the most valued build target instead of least for running or debugging #1811 (tgodzik)
- Add support for breakpoints in toplevel methods in Dotty #1808 (tgodzik)
- Allow for exhaustive pattern matching in case of sealed upper bound types #1787 (ltrojanowski)
- compile before rename instead of checking if compilation is not ongoing #1754 (ltrojanowski)
- Bug-fix: onTypeFormatting is adding .stripMargin even if it's present #1806 (mlachkar)
- Fix ammonite suite flakiness #1803 (tgodzik)
- Use parser for detecting enclosing class for a breakpoint #1783 (tgodzik)
- Update nuprocess to 2.0.1 #1792 (scala-steward)
- Fix issues with symlinks in source directories #1784 (tgodzik)
- Update undertow-core to 2.1.1.Final #1794 (scala-steward)
- Update jackson-databind to 2.11.0 #1790 (scala-steward)
- Update xnio-nio to 3.8.1.Final #1796 (scala-steward)
- Update scalameta, semanticdb-scalac, ... to 4.3.13 #1800 (scala-steward)
- Update sbt, scripted-plugin to 1.3.12 #1797 (scala-steward)
- Update coursier to 2.0.0-RC6-19 #1793 (scala-steward)
- Update scalafmt-dynamic to 2.5.3 #1799 (scala-steward)
- Update flyway-core to 6.4.3 #1795 (scala-steward)
- Update requests to 0.6.2 #1791 (scala-steward)
- fix missing synthetic references #1727 (faizk)
- Use onTypeFormatting to create multiline string #1753 (mlachkar)
- Add in setting to vim docs to help recognize *.sc as Scala files #1785 (ckipp01)
- Automatically add -J to jvm properties and make sure run JVM targets fists #1781 (tgodzik)
- Make sure to persist users choice of build tool #1779 (ckipp01)
- Remove logging from ClasspathLoader #1778 (tgodzik)
- Organize imports with Scalafix #1775 (tgodzik)
- Add file watcher for the standalone ammonite scripts #1771 (tgodzik)
- Handle workspaces with multiple build files. #1758 (ckipp01)
- Add early support for Ammonite scripts #1538 (alexarchambault)
- Try to fix breakpoint DAP suites #1755 (tgodzik)
- Support java files inside java modules for go to definition #1763 (tgodzik)
- Keep modifiers when implementing abstract members #1762 (kpbochenek)
- Export Pants 3rdparty sources #1761 (olafurpg)
- Support Pants'
- Update coursier to 2.0.0-RC6-16 #1741 (scala-steward)
- Update sbt-scalafix to 0.9.15 #1735 (scala-steward)
- Update mdoc-interfaces, sbt-mdoc to 2.2.0 #1747 (scala-steward)
- Update sbt-dotty to 0.4.1 #1733 (scala-steward)
- Update jackson-databind to 184.108.40.206 #1736 (scala-steward)
- Update sbt-ci-release to 1.5.3 #1737 (scala-steward)
- Update requests to 0.5.2 #1738 (scala-steward)
- Update ujson to 1.1.0 #1739 (scala-steward)
- Update sbt-native-packager to 1.7.2 #1740 (scala-steward)
- Update interface to 0.0.22 #1742 (scala-steward)
- Update directory-watcher to 0.9.10 #1743 (scala-steward)
- Update undertow-core to 2.1.0.Final #1744 (scala-steward)
- Update flyway-core to 6.4.2 #1745 (scala-steward)
- Update sbt, scripted-plugin to 1.3.10 #1746 (scala-steward)
- Update munit to 0.7.7 #1748 (scala-steward)
- Update sbt-munit to 0.7.7 #1749 (scala-steward)
- Fix CrossDefinitionLspSuite and additional logs to the DAP suites #1731 (tgodzik)
- Bugfix - formatting for multilines adds pipe in the wrong place #1729 (mlachkar)
- Remove the declaration of the experimental features in initialize and add
- teach metals to accept configuration of range formatting #1717 (danking)
- Bump scalafmt to 2.5.2 #1726 (takezoe)
- Expose fastpass metadata in .bsp/bloop.json #1724 (lukaszwawrzyk)
- handle package object in autoImports #1722 (colineto)
- code action to make single string multiline with strip margin #1685 (colineto)
- Fix issues in files with Scala 2.13 specific syntax #1721 (tgodzik)
- Bump Bloop version and update fastpass to new TraceSettings #1708 (wiwa)
- Try to fix Debug Adapter Suites #1625 (tgodzik)
- Fix behavir when the format dialog is closed without choosing action #1718 (takezoe)
- Always run mill in interactive mode and strip the '--mill-version' #1715 (meshake)
- When no build.properties is available run the recommended sbt version #1713 (tgodzik)
- Make sure we don't download invalid dependencies for Scala 3 #1711 (tgodzik)
- Improve Scala 3 hover #1701 (tgodzik)
- Add in some documentation for vim and
- Update Mill version to 0.6.2 #1702 (tgodzik)
- Add release notes for the 0.9.0 Metals version #1689 (tgodzik)