@@ -20,9 +20,22 @@ It may take a few minutes to import, compile and index the full project.
2020If you have any trouble with importing, you can try to switch the build server from Bloop to sbt,
2121by running the ` Metals: Switch build server ` command from VSCode command palette.
2222
23- ## Configuring the debugger
23+ ## Debugging the unit tests
2424
25- To configure the debugger in VSCode, you can go to the ` Run and Debug ` view and click ` create a launch.json file ` .
25+ If the module you're working on contains unit tests, you can debug a specific one without any additional work.
26+ It can be accomplished by running ` Debug Test ` code lens on an exact test case.
27+
28+ ![ Debug test via code lens] ( /images/contribution/debug-test-code-lens.jpg )
29+
30+ The second way to run a unit test is to use the test explorer tab, which lists all available test cases.
31+ The debugger is started either by pressing a debug button or by selecting ` Debug Test ` option from the menu.
32+
33+ ![ Debug test via code lens] ( /images/contribution/debug-test-explorer.jpg )
34+
35+ ## Debugging the compilation
36+
37+ Debugging of the compilation requires additional configuration in order to work.
38+ In VSCode, you can go to the ` Run and Debug ` view and click ` create a launch.json file ` .
2639It creates the ` launch.json ` file in the ` .vscode ` folder, in which we will define the debug configurations.
2740
2841![ Create launch.json file] ( /images/contribution/launch-config-file.jpg )
@@ -89,9 +102,9 @@ Here is the final configuration:
89102}
90103```
91104
92- ## Customizing the debug configurations
105+ ### Customizing the debug configurations
93106
94- ### Compiling several files at once
107+ #### Compiling several files at once
95108
96109You can compile more than one Scala file, by adding them in the ` args ` :
97110``` json
@@ -103,7 +116,7 @@ You can compile more than one Scala file, by adding them in the `args`:
103116]
104117```
105118
106- ### Depending on a library
119+ #### Depending on a library
107120
108121To add a dependency to an external library you need to download it and all its transitive dependencies, and to add them in the classpath.
109122The Coursier CLI can help you to do that.
@@ -123,19 +136,19 @@ And concatenate the output into the classpath argument, which should already con
123136]
124137```
125138
126- ### Add more compiler options
139+ #### Add more compiler options
127140
128141In the ` args ` you can add any additional compiler option you want.
129142
130143For instance you can add ` -Xprint:all ` to print all the generated trees after each mega phase.
131144
132145Run ` scalac -help ` to get an overview of the available compiler options.
133146
134- ### Defining more than one launch configuration
147+ #### Defining more than one launch configuration
135148
136149You can create as many debug configurations as you need: to compile different files, with different compiler options or different classpaths.
137150
138- ## Starting the debugger
151+ ### Starting the debugger
139152
140153Before starting the debugger you need to put a breakpoint in the part of the code that you want to debug.
141154If you don't know where to start, you can put a breakpoint in the ` main ` method of the ` dotty.tools.dotc.Driver ` trait.
0 commit comments