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
Copy file name to clipboardexpand all lines: docs/contributing/testing-and-debugging.md
+42-17
Original file line number
Diff line number
Diff line change
@@ -13,42 +13,65 @@ The quickest way to test the language server is to debug the language extension
13
13
14
14
This will open another window of Visual Studio Code, this one running as an `[Extension Development Host]`.
15
15
16
-
### Testing in isolation
16
+
### Find the link to Dart DevTools or VM service
17
17
18
-
VS Code ships with some built-in support for SCSS and CSS. To test this language server in isolation you can disable the built-in extension.
18
+
When debugging, the client runs [`dart run --enable-vm-service`](https://github.com/sass/dart-sass-language-server/blob/main/extension/src/server.ts#L49)
19
+
in the local `sass_language_server` package.
19
20
20
-
1. Go to the Extensions tab and search for `@builtin css language features`.
21
-
2. Click the settings icon and pick Disable from the list.
22
-
3. Click Restart extension to turn it off.
21
+
Use the `[Extension Development Host]` window to find the link to open Dart DevTools or to [attach the debugger](#attach-to-language-server).
23
22
24
-
You should also turn off extensions like SCSS IntelliSense or Some Sass.
23
+
1. Open a CSS, SCSS or Sass file to activate the language server.
24
+
2. Open the Output pane (View -> Output in the menu).
25
+
3. Choose Sass in the dropdown to the top right of the Output pane.
26
+
4. Scroll to the top of the output.
25
27
26
-
### Open the Dart DevTools
28
+
You should see something similar to this.
27
29
28
-
In this configuration, the client has run `dart run --observe` in the local `sass_language_server` package. You can now use [Dart DevTools](https://dart.dev/tools/dart-devtools) to debug the language server.
30
+
```
31
+
The Dart VM service is listening on http://127.0.0.1:8181/SMIxtkPzlAY=/
32
+
The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/SMIxtkPzlAY=/devtools/?uri=ws://127.0.0.1:8181/SMIxtkPzlAY=/ws
33
+
```
29
34
30
-
To find the link to open Dart DevTools, use the `[Extension Development Host]`.
35
+
Click the second link to open Dart DevTools, or copy the first link to [attach a debugger](#attach-to-language-server).
31
36
32
-
1. Open a CSS, SCSS or Sass file to activate the language server.
33
-
2. Open the Output pane (View -> Output in the menu).
34
-
3. In the dropdown in the top right, choose Sass from the list.
37
+

38
+
39
+
### Attach to language server
35
40
36
-
You should see output similar to this.
41
+
The debugger in Dart DevTools is deprecated in favor the debugger that ships with [Dart for Visual Studio Code][vscodedart].
42
+
43
+
To start debugging in VS Code (provided you have the Dart extension):
44
+
45
+
1.[Run the language server and extension](#run-the-language-extension-and-server) in debug mode.
46
+
2.[Find the link to the Dart VM](#find-the-link-to-dart-devtools-or-vm-service).
47
+
48
+
You should see output similar to this in the `[Extension Development Host]`.
37
49
38
50
```
39
51
The Dart VM service is listening on http://127.0.0.1:8181/SMIxtkPzlAY=/
40
52
The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/SMIxtkPzlAY=/devtools/?uri=ws://127.0.0.1:8181/SMIxtkPzlAY=/ws
41
53
```
42
54
43
-

55
+
Copy the first link, then go back to the Run and debug window where you started the language server and extension.
56
+
57
+
1. Click the Run and debug drop-down and run `Attach to language server`.
58
+
2. Paste the link you copied and hit Enter.
59
+
60
+
Your debugger should be attached, allowing you to place breakpoints and step through code.
61
+
62
+
### Test in VS Code without built-in SCSS features
44
63
45
-
Click the second link to open Dart DevTools.
64
+
VS Code ships with some built-in support for SCSS and CSS. To test this language server in isolation you can disable the built-in extension.
46
65
47
-
The Debugger tab has a File explorer in which you can find `package:sass_language_server`. Go to `src/language_server.dart` to find the request handlers for messages coming in from the client.
66
+
1. Go to the Extensions tab and search for `@builtin css language features`.
67
+
2. Click the settings icon and pick Disable from the list.
68
+
3. Click Restart extension to turn it off.
69
+
70
+
You should also turn off extensions like SCSS IntelliSense or Some Sass.
48
71
49
72
## Debug unit tests
50
73
51
-
Assuming you installed [Dart for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code) you can debug individual unit tests by right-clicking the Run button in the editor gutter.
74
+
Assuming you installed [Dart for Visual Studio Code][vscodedart] you can debug individual unit tests by right-clicking the Run button in the editor gutter.
52
75
53
76
Writing a test is often faster when debugging an issue with a specific language feature, and helps improve test coverage.
54
77
@@ -71,3 +94,5 @@ test profile in the Run and Debug view in VS Code.
0 commit comments