Skip to content

Commit 527307b

Browse files
Update IDE instructions
Mention `setup-ide`.
1 parent f11171f commit 527307b

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

website/docs/ide.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,36 @@ IDE support for sources managed by the Scala CLI is experimental, and limited to
88
Code](https://scalameta.org/metals/docs/editors/vscode) or
99
[Neovim](https://github.com/scalameta/nvim-metals) for now.
1010

11-
## VSCode
11+
Two kind of support co-exist for VSCode:
12+
- [one relying purely on BSP](#vscode-bsp), with no automatic reload upon adding new dependencies for now.
13+
- [one relying on a custom Metals server](#vscode-custom-metals-server), featuring an import right from VSCode, and having automatic reload support upon adding new dependencies,
14+
15+
## VSCode (BSP)
16+
17+
This Scala CLI support should work with any recent version of Metals. In order to
18+
open a Scala CLI project in Metals, run the `setup-ide` command first:
19+
```text
20+
scala-cli setup-ide .
21+
```
22+
(replace `.` with another set of inputs if these are different.) This should create
23+
a file named `.bsp/scala-cli.json`.
24+
25+
Then open the directory where you ran the `setup-ide` command in VSCode. Provided
26+
the current directory doesn't also contain an sbt or Mill project, the Scala CLI
27+
project should be automatically detected by Metals, and most Metals features (code
28+
navigation, diagnostics in editor, etc.) should work.
29+
30+
If you add dependencies (via `import $ivy` or `using` directives), re-run the
31+
`setup-ide` above, and run the command "Metals: Connect to build server".
32+
33+
## VSCode (custom Metals server)
1234

1335
### Setup
1436

15-
Scala CLI support in Metals / VSCode requires the latest Metals VSCode extension (>= `1.10.8`). Ensure
37+
This Scala CLI support in Metals / VSCode requires the latest Metals VSCode extension (>= `1.10.8`). Ensure
1638
it is installed and up-to-date, or install or update it from the Extension panel in VSCode.
1739

18-
Scala CLI support relies on a custom Metals server for now. To enable it in the current project,
40+
This Scala CLI support relies on a custom Metals server for now. To enable it in the current project,
1941
run the command "Create New Integrated Terminal (in Active Workspace)", and type
2042
```bash
2143
mkdir -p .vscode

0 commit comments

Comments
 (0)