1
- # TypeScript Test Writing Guide for Copilot
1
+ # Guide for Copilot
2
2
3
3
This document provides a concise guide for writing TypeScript fourslash tests and compiler tests, along with build instructions.
4
4
@@ -279,6 +279,25 @@ npx hereby runtests --tests=tests/cases/fourslash/completion*.ts
279
279
- Maintainer comments in the issue should generally take priority over OP's comments
280
280
- Maintainers might give you hints on where to start. They are not always right, but a good place to start
281
281
282
+ ### Debugging Tips
283
+
284
+ printf debugging is going to be very useful as you are figuring things out.
285
+ To do this, use ` console.log ` , but you'll need to ` ts-ignore ` it.
286
+ Write something like this:
287
+ ``` ts,diff
288
+ function checkSomething(n: Node) {
289
+ doSomething(n);
290
+ + // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
291
+ + console.log(`Got node with pos = ${n.pos}`);
292
+ doSomethingElse(n);
293
+ }
294
+ ```
295
+ We have a lot of enums so you might want to print back their symbolic name, to do this, index back into the name of the enum
296
+ ``` ts
297
+ // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
298
+ console .log (` Got node with kind = ${SyntaxKind [n .kind ]} ` );
299
+ ```
300
+
282
301
## Recommended Workflow
283
302
284
303
When fixing bugs or implementing features, follow this workflow:
@@ -305,3 +324,4 @@ When fixing bugs or implementing features, follow this workflow:
305
324
306
325
6 . ** Always format and lint**
307
326
- Don't forget to run ` npx hereby lint ` and ` npx hereby format ` before you're done
327
+ - Double-check your line endings. Source files in this repo typically use CRLF line endings. Fix all line endings to be consistent before you wrap up
0 commit comments