You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that `--dependency` is only meant as a convenience. You should favour
15
-
adding dependencies in the sources themselves via [using directives](./guides/configuration.md#special-imports). However, `--dependency` CLI option takes precedence over using directives, so it can be used to override version temporarily.
14
+
Note that `--dependency` is only meant as a convenience.
15
+
You should favor adding dependencies in the sources themselves via [using directives](./guides/configuration.md#special-imports).
16
+
<!-- TODO #344
17
+
However, `--dependency` CLI option takes precedence over `using` directives, so it can be used to override the `using` directive, such as when you want to work with a different dependency version. -->
16
18
17
19
You can also add repositories on the command-line, via `--repository`:
Copy file name to clipboardExpand all lines: website/docs/guides/ide.md
+28-39Lines changed: 28 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,66 +4,55 @@ sidebar_position: 10
4
4
---
5
5
6
6
:::warning
7
-
IDE support is under development mainly because changes needs to be done in both Metals and IntelliJ.
7
+
IDE support is currently under devlopment, primarily because changes needs to be made in both Metals and IntelliJ.
8
8
:::
9
9
10
10
11
-
Scala CLI currently Scala integrates with IDEs using [BSP protocol](https://build-server-protocol.github.io/). At this moment Scala CLI is not automatically detected so we need to use [Build Server Discovery](https://build-server-protocol.github.io/docs/server-discovery.html) from the BSP protocol. This is the main reason we create the BSP connection details file (`.bsp/scala-cli.json`) for your editor to pick up.
11
+
Scala CLI currently integrates with a build server using the [BSP protocol](https://build-server-protocol.github.io/).
12
+
At this moment Scala CLI is not automatically detected, so we need to use [Build Server Discovery](https://build-server-protocol.github.io/docs/server-discovery.html) from BSP protocol to generate a connection details file (`.bsp/scala-cli.json`).
12
13
13
14
:::note
14
-
If none of the following commands were ran: `compile`, `run`, `test`,
15
-
`setup-ide` or a `.bsp/scala-cli.json` file has yet to be created (or was deleted), your editor
16
-
won't pick up scala-cli as a build server. In that case, simply run one of the
17
-
those commands and the file will be created.
18
-
:::
15
+
If none of these commands were run:
19
16
20
-
Since Scala CLI has a command-line-first approach that is reflected in the IDE
21
-
integrations. By default, Scala CLI stores options passed to the last `compile`,
22
-
`run` or `test` commands and use those options to configure your IDE.
17
+
-`compile`
18
+
-`run`
19
+
-`test`
20
+
-`setup-ide`
23
21
24
-
For more control we also expose a [`setup-ide` command](../commands/setup-ide.md) that allows to fine tune options passed to IDE.
22
+
or a previously-generated connection detail file was deleted, your IDE will *not* use Scala CLI to configure your workspace.
25
23
26
-
Once `setup-ide` is used, Scala CLI does not update configuration based on the latest command.
24
+
In this case, just run one of the commands above to recreate the connection details file.
25
+
:::
27
26
28
-
To enable automatic updates again, remove the `.bsp` directory and run `compile`, `run` or `test` to recreate the connection details file (`.bsp/scala-cli.json`).
27
+
Since Scala CLI has a command-line-first approach, this is reflected in its IDE integration.
28
+
By default, Scala CLI stores options passed to the last `compile`, `run`, or `test` command, and uses those options to configure the IDE.
29
29
30
-
For now non-local sources are supported. What are non-local sources? Gists, URLs or piped sources.
30
+
For more control we also expose the [`setup-ide` command](../commands/setup-ide.md), which lets you fine-tune the options that are passed to the IDE.
31
31
32
+
But note that once `setup-ide` is used, Scala CLI does not update the configuration based on latest command.
33
+
To enable automatic updates again, remove the `.bsp` directory and run `compile`, `run`, or `test` to recreate the connection details file.
32
34
33
-
Scala CLI was tested with two main IDEs for Scala:
34
-
-[Metals](https://scalameta.org/metals/): LSP server for Scala used with [Visual Studio Code](https://code.visualstudio.com/), [Vim](https://www.vim.org/) and many other editors
35
-
-[Intelij Idea](https://www.jetbrains.com/idea/) with [Scala Plugin](https://confluence.jetbrains.com/display/SCA/Scala+Plugin+for+IntelliJ+IDEA?_ga=2.54176744.1963952405.1634470110-410935139.1631638301) installed
35
+
<!-- TODO: Does this belong here? Is it related to IDEs? -->
36
+
For now non-local sources are supported. What are non-local sources? Gists, URLs or piped sources.
36
37
37
-
In ideal world, we would replace the rest of this Guide with something along the
38
-
lines of: `Scala CLI works with all IDEs above as you would expect` however
39
-
mainly due to how fresh Scala CLI is and also due to our radical approach to the
40
-
project structure using a Scala CLI-powered projects with your favourite IDE may
41
-
not be as amazing as we would like to be.
42
38
43
-
Proper IDE integration is our top priority at the moment.
39
+
Scala CLI has been tested with two main Scala IDEs:
40
+
-[Metals](https://scalameta.org/metals/), which is an LSP server for Scala, and is used with [Visual Studio Code](https://code.visualstudio.com/), [Vim](https://www.vim.org/) and many other editors
41
+
-[IntelliJ IDEA](https://www.jetbrains.com/idea/), with the [Scala Plugin](https://confluence.jetbrains.com/display/SCA/Scala+Plugin+for+IntelliJ+IDEA?_ga=2.54176744.1963952405.1634470110-410935139.1631638301) installed
42
+
43
+
In an ideal world we would replace the rest of this guide with something along the lines of, “Scala CLI works within IDEs above as you would expect.” However, mainly due to how fresh Scala CLI is, and also due to our radical approach to the project structure, using a Scala CLI project with your favourite IDE may not be as amazing as we would like. (That being said, proper IDE integration is our top priority at this moment!)
44
44
45
45
## Metals
46
46
47
-
Once Metals picks up proper project structure then basic features like navigation, diagnostics or code completion should work.
47
+
Once Metals picks up the project structure that’s created by Scala CLI, basic features like navigation, diagnostics, and code completion should work.
48
48
49
-
The Current release Metals (0.10.8) is not able to pick changes in the build
50
-
structure automatically and this includes adding new source files. In order
51
-
for Metals to pick up new files or changes in build structure you'll need to
52
-
trigger the 'Restart build server' command.
53
49
54
-
Main classes and tests are at this moment not recognized in Metals.
55
50
56
-
Generally, mainly due to problems with keeping project structure up to date
57
-
Metals can assists with writing code while using Scala CLI, but it cannot be the
58
-
source of truth and we recommend falling back to command line in such cases.
59
51
60
52
## IntelliJ
61
53
62
-
In terms of IntelliJ, the most significant problem is that IntelliJ requires sources to be placed within a directory. This means that top level sources are not recognized as proper sources.
63
-
64
-
With IntelliJ, we strongly suggested to placed your sources within a directory (like `src`).
65
-
66
-
IntelliJ currently does not automatically pick up changes in project structure so any change in dependencies, compiler options etc. needs manual reload.
54
+
Here are a few notes related to IntelliJ support:
67
55
68
-
Similarly to Metals, we don't currently advise using Intellij as a source of
69
-
truth and we recommend falling back to command line in such cases.
56
+
- The most significant problem with IntelliJ is that it requires sources to be placed within a directory. Therefore, if you use IntelliJ, we strongly suggest that you place your sources in a directory (like `src`).
57
+
- IntelliJ currently does not automatically pick up changes in the project structure, so any change in dependencies, compiler options, etc., need to be manually reloaded.
58
+
- We currently don’t advise using IntelliJ as a source of truth, and we recommend falling back to command line in such cases.
0 commit comments