Metals v0.8.4 - Cobalt
We are happy to announce the release of Metals v0.8.4, which will most likely be the last 0.8.x version.
Commits since last release | 174 |
Merged PRs | 55 |
Contributors | 9 |
Closed issues | 13 |
New features | 3 |
For full details: https://github.com/scalameta/metals/milestone/22?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.
TL;DR
Check out https://scalameta.org/metals/, and give Metals a try!
- navigating to parent method
- support for
launch.json
- new "Create new symbol" code action
- miscellaneous improvements
Navigating to parent method
Metals will now calculate if any definition of a method in the current file overrides another method, in which case it will show a new lens next to the method's position. Once clicked, the user will be able to go to the super method. Lenses also link to methods in external dependencies and are displayed in files from libraries. For this new feature to work make sure that you enable code lenses in your client.
If they are found to be disturbing your workflow they can be easily disabled via
the metals.superMethodLensesEnabled
configuration option - they are enabled by
default. For example in Visual Studio Code:
These new lenses should be quick to calculate but if you notice significant slowdown you can also disable them, since when disabled they are not only not displayed but also not calculated at all.
There is also an exposed server command goto-super-method
that can be mapped
and used through shortcut in Visual Studio Code.
It is possible to also navigate the whole inheritance hierachy at once using the
new super-method-hierarchy
command.
This new command can be invoked on a method definition. It calculates super method hierarchy and if more than one position is found it displays a quickPick window (same as the new scala file feature) which displays all super methods and allows a user to select one and jump to its definition.
As an example in Visual Studio Code it can be bound to a shortcut this way:
Thanks to kpbochenek from VirtusLab for this new feature!
Support for 'launch.json'
Previously, it was only possible to launch main classes or tests via code lenses that would appear above a particular class. Now, we add a way for a user to be able specify the name of the the class or test to run. We will then automatically try to detect the build target, which that class/test belongs to and run it. In this release, we also add a way to specify the main class arguments.
While this will be primarily useful for the Visual Studio Code Metals extension,
it will also make it easier for other editors that support the Debug Adapter
Protocol. To obtain the uri needed for starting a debug session users can now
execute the debug-adapter-start
command with params:
- for main class
{
"mainClass": "com.foo.App",
"buildTarget": "foo",
"args": ["bar"]
}
- for test class
{
"testClass": "com.foo.FooSuite",
"buildTarget": "foo"
}
buildTarget
is an optional parameter, which might be useful if there are
identically named classes in different modules. A uri will be returned that can
be used by the DAP client.
More information about adding support for debugging is available here.
This awesome new feature was contributed by alekseiAlefirov from VirtusLab.
New 'Create new symbol...' code action
Previously we would propose to import a symbol (if available) in response to "missing symbol" errors. Now, thanks to gabro, we also propose to create a new class, case class, trait or object.
This might be useful when sketching out a domain model and should improve user experience for fast prototyping.
Miscellaneous improvements
package
is no longer added on imports from package objects- if user right clicks on a file in Visual Studio Code the option for
New Scala file
also shows now the same as for directories - a multiline string can now be formatted exclusively when using
format selection
on that string - added in
...
to signify truncation in worksheets - fixed hover on Scala App trait and several other cases that showed up on Scala Play projects
- messages about upgrading Scala versions are now more valid to the user
- references in a file are sorted before showing them
- better cursor position when creating new files using the
New Scala file
command - added "case class" option in NewFilesProvider
Contributors
Big thanks to everybody who contributed to this release!
$ git shortlog -sn --no-merges v0.8.3..v0.8.4
Olafur Pall Geirsson
Chris Kipp
Aleksei Alefirov
Gabriele Petronella
Tomasz Godzik
Krzysztof Bochenek
Alexandre Archambault
Scala Steward
Martin Duhem
Tomasz Pasternak
Łukasz Wawrzyk
Meriam Lachkar
duianto
Merged PRs
v0.8.4 (2020-04-10)
Merged pull requests:
- Upgrade to latest Bloop. #1595 (olafurpg)
- Fix
package
added artificially on imports from package objects #1593 (tgodzik) - Create a new file next to an existing one if user selected a file #1592 (tgodzik)
- Fix bug around resetting presentation compilers. #1590 (olafurpg)
- fix indentation for multiline string when using format selection #1585 (mlachkar)
- Add disabled X-detectExternalProjectFiles flag #1589 (lukaszwawrzyk)
- Add VersionedDocsModifier #1584 (gabro)
- Remove .bloop symbolic link during Pants export #1587 (olafurpg)
- Small changes to Pants integration #1583 (olafurpg)
- 'StartDebugAdapter' command now accepts user's parameters (launch.json) #1466 (alekseiAlefirov)
- Convert recursive Pants globs into directory entries. #1581 (olafurpg)
- Project root again #1580 (tpasternak)
- Small tweaks to Pants export #1579 (olafurpg)
- Support
extra_jvm_options
from Pants #1578 (Duhemm) - Add in ... to signifigy truncation in worksheets #1576 (ckipp01)
- Small clean-ups #1531 (alexarchambault)
- Fix typo, double "the" #1573 (duianto)
- Fix: don't show super lenses on synthetic methods e.g. toString #1572 (kpbochenek)
- Forward compiler options in Pants export. #1571 (olafurpg)
- Make sure we detect scala App trait when using hover. #1568 (tgodzik)
- More fixes for the Pants integration #1570 (olafurpg)
- Fix recommendations for Scala versions and add better messages. #1549 (tgodzik)
- Update nuprocess to 2.0.0 #1564 (scala-steward)
- Remove deprecations #1561 (ckipp01)
- Update lsp4j-debug #1556 (ckipp01)
- Fix name of scala-steward file #1567 (ckipp01)
- Update bloop-config, bloop-frontend, ... to 1.4.0-RC1-162-888454e1 #1562 (scala-steward)
- Update sbt-native-packager to 1.7.0 #1566 (scala-steward)
- Update sbt-native-packager to 1.6.2 #1563 (scala-steward)
- Add in the scala steward conf file #1558 (ckipp01)
- Remove scalacheck #1559 (gabro)
- Add in new url for Chris #1560 (ckipp01)
- Update coursier dependencies #1557 (ckipp01)
- A few more dependency updates #1555 (ckipp01)
- Add FlakyWindows tags to the hover suite #1551 (ckipp01)
- Dependency updates #1554 (ckipp01)
- Add support to query remote language server as fallback. #1547 (olafurpg)
- Sort references before returning them #1526 (ckipp01)
- Several small polishing touches for Pants integration #1552 (olafurpg)
- Remove Pants targets of type 'target' #1550 (olafurpg)
- Specify cursor position when creating new files #1546 (gabro)
- Change go to parent lenses to true by default #1541 (tgodzik)
- Update mdoc dependencies #1544 (ckipp01)
- Update scalameta dependency #1545 (ckipp01)
- Update sbt-munit plugin #1543 (ckipp01)
- Allow multiple "Create new symbol" actions on a range #1540 (gabro)
- Update to latest munit #1534 (ckipp01)
- Goto super method in hierarchy of inheritance #1487 (kpbochenek)
- Add one more version to list of known old Bloop versions #1533 (olafurpg)
- Export
tags
inBloopPants
#1532 (Duhemm) - Add "Create new symbol '$name'..." code action #1528 (gabro)
- Add "case class" option in NewFilesProvider #1525 (gabro)
- Update lsp4j to enable more 3.15 support #1522 (ckipp01)
- Minor polish for Pants integration #1521 (olafurpg)
- Don't run bloop install when opening intellij #1519 (lukaszwawrzyk)
- Prepare for a new release #1518 (olafurpg)