Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize readme with website #25

Merged
merged 1 commit into from
Dec 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/vscode-connect-build-server.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added assets/vscode-import-build.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/vscode-import-changes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added assets/vscode-reconnect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/vscode-run-doctor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/vscode-server-version.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed img/sbt-bloopinstall.png
Binary file not shown.
Binary file removed img/sbt-import-changes.png
Binary file not shown.
Binary file removed img/vscode-run-doctor.png
Binary file not shown.
89 changes: 54 additions & 35 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,72 +23,98 @@ following table shows the status of various features.

## Requirements

**Java 8**. Metals does not work with Java 11 yet so make sure JAVA_HOME is
configured to use Java 8.
**Java 8**. Metals does not work with Java 11 yet so make sure the JAVA_HOME
environment variable points to Java 8.

**macOS, Linux or Windows**. Metals is developed on macOS and every PR is tested
on Ubuntu+Windows.

**Scala 2.12 and 2.11**. Metals works only with Scala versions 2.12.{8,7,6,5,4}
and 2.11.{12,11,10,9}. Note that 2.10.x and 2.13.0-M5 are not supported.
**Scala 2.12 and 2.11**. Metals works only with Scala versions 2.12.8, 2.12.7,
2.12.6, 2.12.5, 2.12.4, 2.11.12, 2.11.11, 2.11.10 and 2.11.9. Note that 2.10.x
and 2.13.0-M5 are not supported.

## Installation

Install the Metals extension from the Marketplace, search for "Metals".

[Click here to install the Metals VS Code plugin](vscode:extension/scalameta.metals)
[![Install Metals extension](https://img.shields.io/badge/metals-vscode-blue.png)](vscode:extension/scalameta.metals)

> Make sure to disable the extensions
> [Scala Language Server](https://marketplace.visualstudio.com/items?itemName=dragos.scala-lsp)
> and
> [Scala (sbt)](https://marketplace.visualstudio.com/items?itemName=lightbend.vscode-sbt-scala)
> if they are installed. The
> [Dotty Language Server](https://marketplace.visualstudio.com/items?itemName=lampepfl.dotty)
> does **not** need to be disabled because the Metals and Dotty extensions don't
> conflict with each other.

Next, open a directory containing a `build.sbt` file. The extension activates
when a `*.scala` or `*.sbt` file is opened.

## Importing a build

The first time you open Metals in a new sbt build it prompts you to "Import
build via Bloop". This step is required for compile errors and goto definition
to work.
The first time you open Metals in a new workspace it prompts you to import the
build. Click "Import build" to start the installation step.

![Import build](assets/vscode-import-build.png)

![Import build via Bloop](img/import-via-bloop.png)
- "Not now" disables this prompt for 2 minutes.
- "Don't show again" disables this prompt forever, use `rm -rf .metals/` to
re-enable the prompt.
- Behind the scenese, Metals uses [Bloop](https://scalacenter.github.io/bloop/)
to import sbt builds, but you don't need Bloop installed on your machine to
run this step.

Click "Import build via Bloop" to start the `sbt bloopInstall` import step.
Once the import step completes, compilation starts for your open `*.scala`
files.

![sbt bloopInstall](img/sbt-bloopinstall.png)
Once the sources have compiled successfully, you can navigate the codebase with
"goto definition" with `Cmd+Click`.

While the `sbt bloopInstall` step is running, no Metals functionality works.
### Speeding up import

This step can take a long time, especially the first time you run it in a new
build. The exact time depends on the complexity of the build and if library
dependencies are cached or need to be downloaded. For example, this step can
take everything from 10 seconds in small cached builds up to 10-15 minutes in
large uncached builds.
The "Import build" step can take a long time, especially the first time you run
it in a new build. The exact time depends on the complexity of the build and if
library dependencies need to be downloaded. For example, this step can take
everything from 10 seconds in small cached builds up to 10-15 minutes in large
uncached builds.

Once the import step completes, compilation starts for your open `*.scala`
files. Once the sources have compiled successfully, you can navigate the
codebase with "goto definition" by `Cmd+click` or `F12`.
Consult the
[Bloop documentation](https://scalacenter.github.io/bloop/docs/build-tools/sbt#speeding-up-build-export)
to learn how to speed up build import.

### Importing changes

When you change `build.sbt` or sources under `project/`, you will be prompted to
re-import the build.

![Import sbt changes](img/sbt-import-changes.png)
![Import sbt changes](assets/vscode-import-changes.png)

### Manually trigger build import

Click "Import changes" and that will restart the `sbt bloopInstall` step. Select
"Don't show again" if you prefer to manually trigger build import.
To manually trigger a build import, execute the "Import build" command through
the command palette (`Cmd + Shift + P`).

To manually trigger a build import, execute the "Import build" command by
opening the "Command palette" (`Cmd + Shift + P`) and search for "import build".
![Import build command](assets/vscode-import-build-command.png)

![Import build command](img/vscode-import-build.png)
## Run doctor

Execute the "Run Doctor" through the command palette to troubleshoot potential
configuration problems in your workspace.

![Run doctor command](assets/vscode-run-doctor.png)

## Configure Java version

The VS Code plugin uses by default the `JAVA_HOME` environment variable (via
[`find-java-home`](https://www.npmjs.com/package/find-java-home)) to find the
[`find-java-home`](https://www.npmjs.com/package/find-java-home)) to locate the
`java` executable. Metals only works with Java 8 so this executable cannot point
to another version such as Java 11.

To override the default Java home location, update the "Java Home" variable to
in the settings menu.

![Java Home setting](img/vscode-java-home.png)
![Java Home setting](assets/vscode-java-home.png)

If this setting is defined, the VS Code plugin uses the custom path instead of
the `JAVA_HOME` environment variable.
Expand All @@ -104,10 +130,3 @@ command to copy the Java 8 home path.
```sh
/usr/libexec/java_home -v 1.8 | pbcopy
```

## Run doctor

Execute the "Run Doctor" from the command palette to troubleshoot potential
configuration problems in your workspace.

![VS Code Run Doctor command](img/vscode-run-doctor.png)