Scala Center October / November highlights

At a glance

Metals

scalameta/metals#337: implement
basic language server and build client with the following features

  • “Import build” for sbt and Bloop projects using the Build Server Protocol.

  • File save triggers compile in the build server and errors are displayed in the
    editor.

  • Goto definition works for project sources and library dependencies.

  • Goto definition works OK despite of syntax and compile errors in the open
    unsaved editor buffer.

  • Comprehensive integration tests that are easy to write and read.

  • Documentation for how to

    • use Metals with the editors Vim, VS Code, Sublime and Atom
    • import sbt and Bloop build
    • integrate new build tools and text editors

    Demo of the new documentation: https://olafurpg.github.io/metals/

Dotty

Fix sourcefile loader to keep package structure

When Dotty IDE needs to read the trees that correspond to a given class, it will
try to unpickle it from TASTy. If the information in TASTy is outdated (e.g. the
source needs to be recompiled), then the sourcefile loader will be used to get
those trees. Because of the different code path, Dotty IDE would then see trees
with a different structure for packages: the top-level imports would not be
present. This is problematic to be able to perform renamings of symbols that
appear in import trees.

To fix this, we introduce a new phase in the Dotty compiler that takes care of
re-creating the package structure, so that we always see the top level imports,
no matter how the tree was obtained.

This work: https://github.com/lampepfl/dotty/pull/5276

Dotty IDE: Find and add workspace root

When the IDE is opened without a workspace (no folder is open), and then a Scala
source is opened, we will now search for the closest possible workspace root
(the closest parent directory that contains a build.sbt). If no such directory
can be found, the parent directory of the file that has been opened is chosen.
This folder is then added as a workspace folder.

Adding a new workspace folder triggers a reloading of the extension. The code of
the extension will be executed in an environment where a workspace root is set,
and Dotty IDE will be able to start correctly.

This work: https://github.com/lampepfl/dotty/pull/5285

Specification for the new structural types

Scala 3 will feature new structural types that behave differently from the
structural types in Scala 2. They include a pluggable mechanism that allow
programmer to implement different support for field and method lookups.

The new specification is now available on Dotty’s
website

Specification for implicit conversions

Implicit conversions have been slightly changed in Scala 3, in order to remove
surprising behavior and make it easier to reason about Scala programs.

The new specification is now available on Dotty’s
website

Adapt structural types to follow recommendations of SIP committee

During discussions with the SIP committee in November, we decided that it would
be best to simplify the implementation of structural types by renaming
selectDynamicMethod to applyDynamic, and changing it so that it directly
accepts the argument to give to the structural call, rather than returning a
closure. These changes have been made and the specification has been updated.

This work: https://github.com/lampepfl/dotty/pull/5377

Store documentation on auxiliary constructors

Because of an error, the parser of Dotty was discarding the documentation that
should be attached to secondary class constructors.

This work: https://github.com/lampepfl/dotty/pull/5393

Improve display of documentation in the IDE

In previous releases of Dotty IDE, we improved it so that it is able to show the
documentation relative to a given symbol. In the next release, we made changes
to the formatting of this documentation. Instead of printing the raw content of
the documentation, we now extract the different parts and formats them to be
easier to read.

This work: https://github.com/lampepfl/dotty/pull/5394

Add support for textDocument/signatureHelp

textDocument/signatureHelp is a request specified in the Language Server
Protocol. It asks the server to return interactive help for completing a method
call: it can highlight the current parameter, show the documentation for this
parameter, etc. In the next release of Dotty IDE, we added support for this
request.

This work: https://github.com/lampepfl/dotty/pull/5395

Add support for textDocument/implementation

textDocument/implementation is another request of the Language Server
Protocol, which asks the language server to return the locations of the
implementations of a given symbol.

This work: https://github.com/lampepfl/dotty/pull/5401

Improve workspace/symbol

workspace/symbol is yet another method of the Language Server Protocol, which
instructs the server to return the list of symbols defined in the workspace. We
improve our language server so that it is more efficient when collecting all the
symbols of the workspace by avoiding to do multiple inspections of the
classpath.

This work: https://github.com/lampepfl/dotty/pull/5443

Support multi-project rename

Last month, we added support for multi-projet find all references. Being able to
do multi-project renamings is really close, but we were previously blocked by
some pending improvements to the support for import nodes in the IDE.

Now that these improvements are available, we’be been able to continue working
on multi-project renaming, and implement it for Dotty IDE.

This work: https://github.com/lampepfl/dotty/pull/5462

Document worksheet mode

Our implementation of the worksheet mode relies on an extension of the Language
Server Protocol. We wrote documentation on how-to use the shiny new worksheets,
and documented this extension to the protocol, so that other clients can add
support.

This work: https://github.com/lampepfl/dotty/pull/5465

MOOCs

Recorded the introductory video lectures for the “Programming
Reactive Systems” course, reviewed the videos after they have been
edited and filled the content of the course on the learning platform.

BSP

Jorge Vicente Cantero and Olafur Pall Geirsson have been working with Justin
Kaeser on BSP v2.0.

The new version includes some architectural changes in the protocol with
respect to 1.0 (for example, the addition of a BSP connection protocol) and
completely rethinks some areas, like diagnostics reporting.

Bloop

Preparing for 1.1.0 release at the end of the month. Milestone
1.1.0
.

The new 1.1.0 release will release all the functionality added during the past
months, including build pipelining and the migration to BSP v2.0. During this
term, there have been some important changes to integrate better with
Metals.

Aside from that, 1.1.0 will sport a new documentation website with a better
organization of the pages, versioned documentation of features and a better
getting started experience.

coursier

almond

  • Prepare the ground for code navigation capabilities
    • make completions and inspections interruptible
    • ship source JARs along the kernel in order to pass those to the presentation compiler
    • tweak Ammonite to get its presentation compiler via its API)

SIP meetings

In the past month, we held 2 SIP meetings, one regular, the online one, and one special, face-to-face extensive meeting.

For October meeting please see the video here, minutes coming soon.

The extensive face-to-face meeting took place 1-3 November at EPFL, Switzerland. More information in the meeting minutes.

Scala Days 2019

Scala Center is organising the ScalaDays 10th edition, June 11-13 2019 at EPFL Switzerland, with crucial support and help from Lightbend and Dajana Günther, CEO at Trifork Germany GmbH.
It was publically announced last month, check out the ScalaDays website. Call for proposals is now open, we are looking forward to reviewing your talks, submit here.
We are planning many exciting community-oriented unconference events during the week of the conference, such as Scala spree, ScalaBridge, Contributors and Typelevel summits.

Conferences, talks, sprees

At ScalaIO in Lyon, October 29 - 11, opened by prof. Martin Odersky keynote “Towards Scala 3 - A Status Report”, the conference Scala Center’s team gave two presentations

Julien Richard-Foy “Scala pour tous”
Sébastien Doeraene “La Recette Magique de Scala.js : un Langage Transplateforme”

Thanks to proactive organisers, we helped organise another Scala spree, this time over the course of 2 days (link).