-
Notifications
You must be signed in to change notification settings - Fork 58
Auto Imports, remove JS/TS config #677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
136090d
ba6975c
87b4e4b
8bcaaf7
a6b0d04
2018955
a9cb5a2
f31a196
0a891f7
5cfe89c
3e614f2
a6c417a
8996962
5796a15
3589b20
2b97e1a
4eb19fe
d5ad04d
5def97d
fbcdd0b
a06a985
6312d7a
918cb33
6dc15df
f416758
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | |
| - Read the project’s [ARCHITECTURE.md](./ARCHITECTURE.md) to understand the basics of how the code base works. | ||
|
|
||
| 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! | ||
|
|
||
| # Common Debugging Scenarios | ||
|
|
||
| ## How to run glint-language-server locally? | ||
|
|
||
| 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: | ||
|
|
||
| ``` | ||
| tsc --build --watch | ||
| ``` | ||
|
|
||
| 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`. | ||
|
|
||
| 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. | ||
|
|
||
| ## How to run glint-language-server locally in debug mode? | ||
|
|
||
| There are a few VSCode Launch Configurations within `./vscode/launch.json` that are handy for debugging: | ||
|
|
||
| - 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 | ||
| - Debug Extension (Glint + TS) | ||
| - This spins up a VSCode window with both Glint and the built-in TS language server running. | ||
| - 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 | ||
| - Debug Extension (Glint Only) | ||
| - 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 | ||
| - 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 | ||
| - _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. | ||
| - _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. | ||
|
|
||
| These launch configurations can be run via the Run and Debug tab in VSCode. | ||
|
|
||
| ## How to test out the VSCode extension locally? | ||
|
|
||
| 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: | ||
|
|
||
| ``` | ||
| yarn run test | ||
| ``` | ||
|
|
||
| Secondly, the Launch Configurations described above (I believe) will run your client-side extension code in debug mode, along with the language server. | ||
|
|
||
| ## How to see the transformed Intermediate Representation (IR) code of a template | ||
|
|
||
| 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: | ||
|
|
||
| ```ts | ||
| static { | ||
| ({} as typeof import("@glint/environment-ember-loose/-private/dsl") | ||
| .templateForBackingValue(this, function(𝚪, χ: typeof import("@glint/environment-ember-loose/-private/dsl")) { | ||
| { | ||
| const 𝛄 = χ.emitComponent(χ.resolve(χ.Globals["FooComponent"]) | ||
| ({ desc: "notchHeight _ footer", ...χ.NamedArgsMarker })); | ||
| 𝛄; | ||
| { | ||
| const [] = 𝛄.blockParams["default"]; | ||
| { | ||
| // ... | ||
| ``` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using these Greek letters makes the code/documentation less readable.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the time of writing, these greek letters were already being used by Glint's "compiler" for transforming templates into type-checkable TS. Note that in the last year I changed these symbols to keywords like |
||
|
|
||
| Sometimes it is useful to see the IR of any .hbs template or .gts/.gjs file for debugging purposes; if you're using VSCode you can see the IR by: | ||
|
|
||
| 1. Enable "Glint: Debug" in your VSCode user preferences | ||
| 2. Run the "Glint: Show IR for Debugging" command | ||
|
|
||
| Your template code will be replaced by the IR directly in your editor window. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a ton for adding this! This is all the information i got super stuck on not having when i was first getting in to glint!
Very needed!