Skip to content

change doc to recommend metals worksheet #12874

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

Closed
wants to merge 1 commit into from
Closed
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
79 changes: 0 additions & 79 deletions docs/docs/usage/worksheet-mode-implementation-details.md

This file was deleted.

34 changes: 14 additions & 20 deletions docs/docs/usage/worksheet-mode.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
---
layout: doc-page
title: "Worksheet mode with Dotty IDE"
title: "Worksheet mode with Metals"
---

A worksheet is a Scala file that is evaluated on save, and the result of each
expression is shown in a column to the right of your program. Worksheets are
A worksheet is a Scala file that is evaluated on save, powered
by [Scala Metals](https://scalameta.org/metals/), and the result of each
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
by [Scala Metals](https://scalameta.org/metals/), and the result of each
by [Scala Metals](https://scalameta.org/metals/) and [mdoc](https://scalameta.org/mdoc/), and the result of each

expression is shown at the end of the line it is defined on. Worksheets are
like a REPL session on steroids, and enjoy 1st class editor support: completion,
hyperlinking, interactive errors-as-you-type, etc. Worksheet use the extension
`.sc`.
`.worksheet.sc`.

How to use the worksheets
=========================
The only supported client for the Worksheet mode is [Visual Studio
Code](https://code.visualstudio.com/).

To use the worksheets, start Dotty IDE by [following the
instruction](ide-support.md) and create a new file `MyWorksheet.sc` and
To use the worksheets, start Metals by [following the
instruction](ide-support.md) and create a new file `MyWorksheet.worksheet.sc` and
write some code:

```scala
Expand All @@ -24,27 +25,20 @@ println("Hello, worksheets!")
456 + xyz
```

On top of the buffer, the message `Run this worksheet` appears. Click it to
evaluate the code of the worksheet. Each line of output is printed on the right
On top of the buffer, the message `Copy Worksheet Output` appears. Save the file to evaluate the code of the worksheet. Each line of output is printed on the right
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't mention Copy Worksheet Output here, it can be mentioned additionally.

of the expression that produced it. The worksheets run with the classes of your
project and its dependencies on their classpath.

![](images/worksheets/worksheet-run.png "Run worksheet")

By default, the worksheets are also run when the file is saved. This can be
configured in VSCode preferences:

![](images/worksheets/config-autorun.png "Configure run on save")

Note that the worksheet are fully integrated with the rest of Dotty IDE: While
typing, errors are shown, completions are suggested, and you can use all the
other features of Dotty IDE such as go to definition, find all references, etc.
Note that the worksheet are fully integrated with the rest of Metals:
When you type, completions are suggested, and when you save errors are shown.
You can use all the other features of Metals such as go to definition,
find all references, etc.

![](images/worksheets/worksheet-help.png "IDE features in the worksheet")

Implementation details
More Information
======================

The implementation details of the worksheet mode and the information necessary to add support for
other clients are available in [Worksheet mode - Implementation
details](worksheet-mode-implementation-details.md).
find out more in the [Metals Documentation](https://scalameta.org/metals/docs/editors/vscode.html#worksheets).
Binary file removed docs/images/worksheets/config-autorun.png
Binary file not shown.
Binary file modified docs/images/worksheets/worksheet-help.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 modified docs/images/worksheets/worksheet-run.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.