Skip to content

Commit 65bf8ae

Browse files
committed
Close #3933 Improvements to the IntelliJ IDEA getting started guide
1 parent 7058f69 commit 65bf8ae

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

docs/docs/contributing/intellij-idea.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,51 @@ its installed on your local machine). Otherwise, specify it by pressing *New*.
2020

2121
![](../../images/idea/idea-sdk.png "Select the JDK")
2222

23-
On the final window we must select which modules we can import. Here, we are presented with the full list of SBT projects
23+
In some versions of IDEA, we must select which modules we can import. Here, we are presented with the full list of SBT projects
2424
that are defined in Dotty. You can either select all (expect performance degradation by IDEA if you select all) or
2525
select only the `dotty` module. In order to do that, unselect all modules and select on `dotty`. IDEA, then, automatically
2626
selects all the necessary dependencies and you press OK.
2727

2828
![](../../images/idea/idea-sbt.png "Select modules to import")
2929

30+
In other versions of IDEA, no choice will be given. After the project loads, right click on `dotty` in the project explorer
31+
and select `Load/Unload Modules...`. Then select only `dotty`, accept when IDEA asks to add its dependencies and press OK.
32+
3033
Running/Debugging
3134
-------
3235

33-
To run the compiler you can do it either as an sbt command or via debugging the compiler.
34-
For the first option you can fire up sbt from the `Terminal` window of IDEA or you can do it externally.
36+
To run the compiler you can do it either as an sbt command or a shell script.
37+
For the first option you can fire up sbt from the `Terminal` window of IDEA or you from an external terminal.
3538
For example, to run a test you can write with or without flags:
3639

3740
```shell
38-
$ dotc tests/pos/Arrays.scala
41+
$ sbt
42+
> dotc tests/pos/Arrays.scala
43+
```
44+
For the second option, the compiler can be run using a script in the `bin` directory:
45+
46+
```shell
47+
$ ./bin/dotc tests/pos/Arrays.scala
3948
```
4049

41-
If you are interested in debugging the compiler you can enable the necessary agent on the JVM.
42-
This is done in two steps. For the first step you need to pass the
43-
necessary flag to the running VM. For convenience, this is already in comments on the `Build.scala` file under the
50+
If you are interested in debugging the compiler, you can use a remote debugging configuration.
51+
This is done in two steps. For the first step you need to configure sbt (actually, its JVM) to
52+
suspend when it runs dotc and wait for a debugger to connect. The necessary flag
53+
must be passed to the JVM. For convenience, this is already in comments in the `Build.scala` file under the
4454
`project` directory. The string you need to uncomment is the following:
4555

4656
> `"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"`
4757
4858
Uncomment the line and reload the project file with the `reload` command on sbt.
49-
Now, each time you run `dotc` the compiler listens at the designated address and waits the agent to connect.
50-
For, the second step you need to create a configuration for Debug through IDEA:
59+
Now, each time you run dotc the compiler listens at `localhost:5005` and waits for a debugger to connect.
60+
For the second step you need to create a configuration for Debug through IDEA:
5161

5262
> Run > Edit Configurations > Add New Configuration > (select) Remote
5363
5464
![](../../images/idea/idea-debug.png "Create a Debug Configuration")
5565

56-
Now every time you run `dotc` you can set your breakpoints and hit the `Debug dotty-debug` button (since we used that name for
57-
the sample configuration above). The default data on the configuration match the enabled agent on the VM so, probably,
66+
Under `Search sources using module's classpath` select `dotty`. After setting breakpoints, run `dotc` from within
67+
sbt. Then hit the `Debug dotty-debug` button (since we used `dotty-debug` for the name of
68+
the sample configuration above) in IDEA to connect the debugger to the JVM and begin debugging. The default data on the debug configuration matches the enabled agent on the VM so, probably,
5869
you will not need to change anything else.
5970

0 commit comments

Comments
 (0)