Skip to content

Commit d6c3ac3

Browse files
Add line endings and printf debugging section (#61947)
1 parent e6a50a7 commit d6c3ac3

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/copilot-instructions.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TypeScript Test Writing Guide for Copilot
1+
# Guide for Copilot
22

33
This document provides a concise guide for writing TypeScript fourslash tests and compiler tests, along with build instructions.
44

@@ -279,6 +279,25 @@ npx hereby runtests --tests=tests/cases/fourslash/completion*.ts
279279
- Maintainer comments in the issue should generally take priority over OP's comments
280280
- Maintainers might give you hints on where to start. They are not always right, but a good place to start
281281

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+
282301
## Recommended Workflow
283302

284303
When fixing bugs or implementing features, follow this workflow:
@@ -305,3 +324,4 @@ When fixing bugs or implementing features, follow this workflow:
305324

306325
6. **Always format and lint**
307326
- 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

Comments
 (0)