Skip to main content

Online IDEs

Metals can also be installed in some online environments, which enable users to work on their code inside of a browser. This can be a good option when users need to set up their workspace quickly or are lacking appropriate resources on their local machine.

Gitpod#

One of such online environments is Gitpod, which can be used directly in your browser as well as shared with others without the need to explicitly set up the tools and settings needed to run Scala project with Metals. You can read more about Gitpod here.

example

Example Gitpod repository for Metals#

An example repository, which is already set up and integrated with Gitpod, can be found here. The project contains, out of the box, everything that you need to start experimenting with Metals in an online environment similar to Visual Studio Code. The only thing that you need to do to set up the environment by yourself is to open the link provided in the README of the project. The import prompt for Metals will show up, however, in this case, .bloop files normally generated during import were created in the gitpod init script, so import will not be needed.

The moment that the import is completed, you will be able to run the code in Main.scala and tests in SampleTest.scala (using code lenses). You can also execute code using Worksheet.worksheet.sc.

If you want to set up your own Gitpod project that already comes with all the necessary tools to run the Scala project with Metals, you can fork and customize this repository.

Gitpod environment can be set up from scratch with the setup assistant. It helps you to create scripts that are then used by Gitpod to make fresh instances of the environment. These scripts are for example:

  • prebuild that can be used to set up the environment on commit push even before opening it
  • init invoked when the workspace is opened for the first time
  • command run every time when the workspace is run again after being stopped

The Gitpod configuration is located under .gitpod.yml. The minimal Gitpod setup requires in our case Scala and Metals extensions to be provided which is already done in the example project.

Gitpod itself is based on the Eclipse Theia project, an editor which can be easily customized according to your needs and is backed by the Eclipse Foundation. The Metals plugin will also work in an environment created within Eclipse Che, which is a complementary project to Theia that helps companies and users create their own online workspace infrastructure. These topics should be especially interesting for larger companies that might want to increase their productivity by improving their developers' experience. With some additional setup it's possible using those tools to have a zero startup environments.

Open VSX#

Metals extension is available in the Open VSX Registry which is used to provide extensions in Gitpod. You can find the newest version of Metals in there.

GitHub Codespaces and GitHub.dev#

First, some definitions:

  • GitHub Codespaces are remote dev containers you can connect to using VS Code Desktop or VS Code Web.
  • GitHub.dev, also referred to as "Browser-based editor", is a version of VS Code Web that runs entirely in your browser (crucially, this is different than connecting to a Codespace using VS Code Web).

Metals fully works in GitHub Codespaces, but not on GitHub.dev.

This is because Codespaces can run Java (being full fledged containerized environments) and extensions have access to a real file system, whereas GitHub.dev is limited to browser-only technologies, hence it can't run Java and it accesses files using a virtual file system (see Virtual Workspaces). These limitations make it impossible to run Metals on GitHub.dev. For more details, see this issue.