Metals and Scala 3

(Metals is developed within the Scala Center, but we are both happy and proud to acknowledge it has reached the maturity of a true community developed and maintained project. The Scala Center team is still deeply invested in the project, and as such we will keep the community updated under the “Scala Center Updates” umbrella, because we are dedicated to providing regular and transparent community updates about project plans & progress. Even though all feedback is welcome, Metals collaborators keep the right to make executive decisions. Overview of all Scala Center activities can always be found at https://scala.epfl.ch/records.html and specifically about Metals at https://scalameta.org/metals/)

Dear Scala Contributors,

Recently, with the release of Metals version 0.9.0 we added basic support for Scala 3. Though it already has a number of features implemented, it is still not one the same level as the support for Scala 2. In this article, we will provide some updates on progress on the support for Scala 3 and other improvements planned for the Metals Scala Language Server.

The goal is making Metals work fully with Scala 3 with the same number of features currently available for Scala 2. In order to do that we also need to work on the scalameta parser, which is necessary for a number of features to work properly in Metals and on the Dotty presentation compiler itself. However, in addition to that we will later need to work on scalafmt, which is needed to support formatting in Metals, scalafix, which will provide refactoring options, and mdoc, which is needed for the worksheet support. All of that will both provide features for Metals itself as well as create a proper tooling ecosystem, which will enable developers to migrate to Scala 3.

Planned features for Scala 3:

  1. Show incomplete type names where sensible - in most cases we do not need a full package name and it can make it less readable (for example “Int” instead of “scala.Int”). scalameta/metals-feature-requests#107
  2. Sort completion results to get most relevant completions first. scalameta/metals-feature-requests#110
  3. Exact types for generic methods - for example “map: Int => String” instead of “map : A => B”. scalameta/metals-feature-requests#108
  4. Signature help for type signatures - signature help shows the signature of the currently typed function and doesn’t currently work with type signatures. scalameta/metals-feature-requests#114
  5. Option for standalone compiler for dotty in case of files outside known targets, currently we always use Scala 2.12 for that. scalameta/metals#1653
  6. Auto imports for symbols outside the current scope coming for example from dependencies or different packages. scalameta/metals-feature-requests#113
  7. Advanced completions existing already in Scala 2. scalameta/metals-feature-requests#112
  8. Scalameta parser working with Dotty syntax - parser is used for a number of features and might currently fail on Dotty specific code and cause some smaller issues Roadmap for Metals and Scala 3 scalameta/scalameta#2022
  9. Code formatting - depends on Scalafmt and the scalameta parser. scalameta/metals-feature-requests#122
  10. Worksheets - depends on mdoc and the scalameta parser scalameta/metals-feature-requests#121
  11. Scalafix refactorings - depends on scalafix and the scalameta parser scalameta/metals-feature-requests#123

Milestone 1 (shorterm):

  • shorter names (1. item) - 4-7 days
  • completion sorting (2. item) - 4-7 days
  • scalameta parser without the optional braces (8. item) 1-2 months

Milestone 2:

  • exact types for generic methods (3. item) 1-2 weeks
  • type signatures for signature help (4. item) - 1-2 weeks
  • scalameta optional braces support (8. item) - 1-2 months

Milestone 3:

  • option for standalone compiler for dotty in case of files outside known target (5. item) 1-2 days
  • scalafmt for Scala 3 (9. item) 2-3 months
  • auto imports (6. item) - 2-3 weeks
  • advanced completions (7. item) - 1-2 months

Milestone 4:

  • worksheets alongside mdoc (10. item) 2-3 weeks
  • scalafix for Scala 3 (11. item) 1-2 months

We don’t provide the exact timeline for the later milestones, since it is impossible currently to foresee how much work will be needed on other parts of Metals and there are a number of unknowns we are still facing. We tried to provide an estimate of how much time will each feature take, but they should not be treated literally, but rather as a measure of complexity of each item.

To find the current issues take a look at:

13 Likes