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: .github/copilot-instructions.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,21 +9,21 @@ Most of our development takes place in the `internal` directory, and most behavi
9
9
10
10
Most development on the codebase is in Go.
11
11
Standard Go commands and practices apply, but we primarily use a tool called `hereby` to build, run tests, and other tasks.
12
-
Run `npx hereby --list` to see all available commands.
12
+
Run `npx hereby --tasks` to see all available commands.
13
13
14
14
```sh
15
-
npx hereby build # Build the project
15
+
npx hereby build # Build the tsgo binary (not required for tests)
16
16
npx hereby test# Run tests
17
17
npx hereby format # Format the code
18
18
npx hereby lint # Run linters
19
19
20
20
# To run a specific compiler test:
21
-
go test -run='TestSubmodule/<test name>' ./internal/testrunner # For submodule tests in _submodules/TypeScript
22
-
go test -run='TestLocal/<test name>' ./internal/testrunner # For local tests in testdata/tests/cases
21
+
go test -run='TestSubmodule/<test name>' ./internal/testrunner # For pre-existing "submodule" tests in _submodules/TypeScript
22
+
go test -run='TestLocal/<test name>' ./internal/testrunner # For new "local" tests created in testdata/tests/cases
23
23
```
24
24
25
-
Always make sure code is formatted, linted, and tested before sending a pull request.
26
-
25
+
Always make sure code is formatted, linted, and tested before sending a pull request.
26
+
27
27
## Compiler Features, Fixes, and Tests
28
28
29
29
When fixing a bug or implementing a new feature, at least one minimal test case should always be added in advance to verify the fix.
@@ -56,10 +56,10 @@ export interface Person {
56
56
function greet(person) {
57
57
console.log(`Hello, ${person.name}!`);
58
58
}
59
-
```
60
-
61
-
**New compiler tests should always enable strict mode (`@strict: true`) unless the bug specifically involves non-strict mode behavior.**
62
-
59
+
```
60
+
61
+
**New compiler tests should always enable strict mode (`@strict: true`) unless the bug specifically involves non-strict mode behavior.**
62
+
63
63
Tests don't always need the above `@option`s specified, but they are common to specify or modify.
64
64
Tests can be run with multiple settings for a given option by using a comma-separated list (e.g. `@option: settingA,settingB`).
65
65
`@filename` is only required when a test has multiple files, or when writing a test for a single JavaScript file (where `allowJs` or `checkJs` is enabled).
This repo uses [Go 1.25 or higher](https://go.dev/dl/), [Rust 1.85 or higher](https://www.rust-lang.org/tools/install), [Node.js with npm](https://nodejs.org/), and [`hereby`](https://www.npmjs.com/package/hereby).
6
+
7
+
For tests and code generation, this repo contains a git submodule to the main TypeScript repo pointing to the commit being ported.
8
+
When cloning, you'll want to clone with submodules:
If you have already cloned the repo, you can initialize the submodule with:
15
+
16
+
```sh
17
+
git submodule update --init --recursive
18
+
```
19
+
20
+
With the submodule in place and `npm ci`, you can run tasks via `hereby`, similar to the TypeScript repo:
21
+
22
+
```sh
23
+
hereby build # Build the tsgo binary (not required for tests)
24
+
hereby test# Run tests
25
+
hereby format # Format the code
26
+
hereby lint # Run linters
27
+
hereby install-tools # Install additional tools such as linters
28
+
hereby generate # Generate all Go code (e.g. diagnostics, committed to repo)
29
+
```
30
+
31
+
Additional tasks are a work in progress.
32
+
33
+
`hereby` is not required to work on the repo; the regular `go` tooling (e.g., `go build`, `go test ./...`) will work as expected.
34
+
`hereby` tasks are provided as a convenience for those familiar with the TypeScript repo.
35
+
36
+
### Running `tsgo`
37
+
38
+
After running `hereby build`, you can run `built/local/tsgo`, which behaves mostly the same as `tsc`.
39
+
40
+
### LSP Server
41
+
42
+
To debug and run the VS Code extension without installing it globally:
43
+
44
+
* Run VS Code in the repo workspace (`code .`)
45
+
* Copy `.vscode/launch.template.json` to `.vscode/launch.json`
46
+
* <kbd>F5</kbd> (or `Debug: Start Debugging` from the command palette)
47
+
48
+
This will launch a new VS Code instance which uses the Corsa LS as the backend. If correctly set up, you should see "tsgo" in the status bar when a TypeScript or JavaScript file is open:
49
+
50
+

0 commit comments