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: CONTRIBUTING.md
+66
Original file line number
Diff line number
Diff line change
@@ -17,3 +17,69 @@ Glint is a family of packages which all live in this repo as a Yarn workspace. T
17
17
- Read the project’s [ARCHITECTURE.md](./ARCHITECTURE.md) to understand the basics of how the code base works.
18
18
19
19
Once you have made changes and added tests to confirm they work correctly, you can then open a PR and we'll work with you to polish it up and get it landed!
20
+
21
+
# Common Debugging Scenarios
22
+
23
+
## How to run glint-language-server locally?
24
+
25
+
If you would like to connect your editor to a locally running version of the Glint language server, first start the `tsc` compiler in watch mode from the root folder of the Glint repo:
26
+
27
+
```
28
+
tsc --build --watch
29
+
```
30
+
31
+
Then you can configure your editor to point to the absolute path of the `./packages/core` folder within this repo when launching the language server. For VSCode users, this means opening your user preferences (after having already installed the Glint VSCode extension) and setting "Glint: Library Path" (aka `glint.libraryPath`) to the absolute path of the `packages/core` folder, e.g. `/Users/machty/code/glint/packages/core`.
32
+
33
+
With the running `tsc --build --watch` command, the language server will rebuild when any source code files change. _Important_: after any source code file change and subsequent rebuild, you will need to restart the language server from within your editor in order for the changes to be reflected in your editor. In VSCode, this means running "Glint: Restart Glint Server" from the Command Palette.
34
+
35
+
## How to run glint-language-server locally in debug mode?
36
+
37
+
There are a few VSCode Launch Configurations within `./vscode/launch.json` that are handy for debugging:
38
+
39
+
- Both will enable the TS/JS debugger on both the language server and the client-side VSCode extension code, meaning the debug breakpoints will pause execution to allow you to debug things like text completions
40
+
- Debug Extension (Glint + TS)
41
+
- This spins up a VSCode window with both Glint and the built-in TS language server running.
42
+
- In this mode, both language servers will provide duplicate completions and suggestions, which can be useful for testing out feature parity between Glint and TS
43
+
- Debug Extension (Glint Only)
44
+
- This is useful for testing out the "takeover" mode of running Glint, where Glint is responsible for providing all of the language features (debugging, diagnostics, etc); this is the ideal way to run Glint, but at the time of writing we have not yet achieved feature parity with built-in TS
45
+
- By default these extensions will launch the VSCode Extension Host in the `test-packages` subfolder, which have Ember and Glimmerx apps that you can do some basic testing on
46
+
-_TIP_: you can open any workspace with the Extension Host, meaning you can even debug the language server with breakpoints on a totally separate Ember repo, for example.
47
+
-_NOTE_: debugging takes place within the `glint` workspace, i.e. if you are debugging completions, you'd trigger a completion within the Extension Host, and the breakpoint would pause within the Glint workspace VSCode instance.
48
+
49
+
These launch configurations can be run via the Run and Debug tab in VSCode.
50
+
51
+
## How to test out the VSCode extension locally?
52
+
53
+
Firstly, there is an entire suite of integration tests that will spin up instances of VSCode and test out the VSCode Glint extension. These can be run from the `packages/vscode` directory via:
54
+
55
+
```
56
+
yarn run test
57
+
```
58
+
59
+
Secondly, the Launch Configurations described above (I believe) will run your client-side extension code in debug mode, along with the language server.
60
+
61
+
## How to see the transformed Intermediate Representation (IR) code of a template
62
+
63
+
Glint transforms template code into TypeScript code so that it can be type-checked by the vanilla TS compiler. Transformed IR code looks something like:
Copy file name to clipboardExpand all lines: README.md
+4
Original file line number
Diff line number
Diff line change
@@ -39,3 +39,7 @@ Similarly, `glint-language-server` can be used by editor integrations to expose
39
39
The language server can also enable your editor to provide other richer help, such as type information on hover, automated refactoring, and more. See [the VS Code extension README](packages/vscode) for further examples.
0 commit comments