Skip to content

Commit 94e7d4f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into goto-function-name
2 parents df72e00 + 8370e5f commit 94e7d4f

File tree

29,899 files changed

+665229
-664321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

29,899 files changed

+665229
-664321
lines changed

.dprint.jsonc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"cwd": "${configDir}",
4242
"cacheKey": "4",
4343
"commands": [
44-
{ "command": "gofumpt -lang=go1.24", "exts": ["go"] }
44+
{ "command": "go tool mvdan.cc/gofumpt -lang=go1.24", "exts": ["go"] }
4545
]
4646
},
4747
"excludes": [
@@ -50,17 +50,18 @@
5050
"**/*-lock.json",
5151
"**/testdata",
5252
"_submodules/**",
53-
"**/*_generated.go",
5453
"internal/bundled/libs/**",
5554
"internal/lsp/lsproto/_generate/*.json",
56-
"internal/lsp/lsproto/_generate/metaModelSchema.mts"
55+
"internal/lsp/lsproto/_generate/metaModelSchema.mts",
56+
// Needs to be LF to have a working shebang.
57+
"_packages/native-preview/bin/tsgo.js"
5758
],
5859
// Note: if adding new languages, make sure settings.template.json is updated too.
5960
// Also, if updating typescript, update the one in package.json.
6061
"plugins": [
61-
"https://plugins.dprint.dev/typescript-0.94.0.wasm",
62+
"https://plugins.dprint.dev/typescript-0.95.7.wasm",
6263
"https://plugins.dprint.dev/json-0.20.0.wasm",
63-
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm",
64+
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm",
6465
"https://plugins.dprint.dev/exec-0.5.1.json@492414e39dea4dccc07b4af796d2f4efdb89e84bae2bd4e1e924c0cc050855bf"
6566
]
6667
}

.github/actions/setup-go/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
steps:
1515
- name: Install Go
1616
id: install-go
17-
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
17+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1818
with:
1919
go-version: ${{ inputs.go-version }}
2020
cache: false

.github/copilot-instructions.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
This is the codebase for a native port of the TypeScript compiler and language server.
2+
The source directories of interest that we have are:
3+
4+
- `internal` - Contains the compiler and language server code.
5+
- `_extension` - Contains a preview VS Code extension code that integrates with the language server.
6+
- `_submodules/TypeScript` - the stable TypeScript repository, checked out at the appropriate commit.
7+
8+
Most of our development takes place in the `internal` directory, and most behaviors can be tested via compiler tests.
9+
10+
Most development on the codebase is in Go.
11+
Standard Go commands and practices apply, but we primarily use a tool called `hereby` to build, run tests, and other tasks.
12+
Feel free to install `hereby` globally (`npm install -g hereby`) if it is easier, and run `hereby --list` to see all available commands.
13+
14+
```sh
15+
hereby build # Build the project
16+
hereby test # Run tests
17+
hereby format # Format the code
18+
hereby lint # Run linters
19+
```
20+
21+
Always make sure code is formatted, linted, and tested before sending a pull request.
22+
23+
## Compiler Features, Fixes, and Tests
24+
25+
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.
26+
This project primarily uses snapshot/baseline/golden tests rather than unit tests.
27+
New compiler tests are written in `.ts`/`.tsx` files in the directory `testdata/tests/cases/compiler/`, and are written in the following format:
28+
29+
```ts
30+
// @target: esnext
31+
// @module: preserve
32+
// @moduleResolution: bundler
33+
// @strict: true
34+
// @checkJs: true
35+
36+
// @filename: fileA.ts
37+
38+
export interface Person {
39+
name: string;
40+
age: number;
41+
}
42+
43+
// @filename: fileB.js
44+
45+
/** @import { Person } from "./fileA" */
46+
47+
/**
48+
* @param {Person} person
49+
*/
50+
function greet(person) {
51+
console.log(`Hello, ${person.name}!`);
52+
}
53+
```
54+
55+
Tests don't always need the above `@option`s specified, but they are common to specify or modify.
56+
Tests can be run with multiple settings for a given option by using a comma-separated list (e.g. `@option: settingA,settingB`).
57+
`@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).
58+
You can see more tests in `_submodules/TypeScript/tests/cases/{compiler,conformance}`.
59+
60+
When tests are run, they will produce output files in the `testdata/baselines/local` directory.
61+
**Test failures are fine** if they are just differences in output files.
62+
A reduction/removal of `.diff` file baselines is **ideal** because it indicates the port has converged in behavior with the stable TypeScript codebase.
63+
The new outputs can be diffed against `testdata/baselines/reference` to see if the output has changed.
64+
65+
Running
66+
67+
```sh
68+
npx hereby baseline-accept
69+
```
70+
71+
will update the baselines/snapshots, and `git diff` can be used to see what has changed.
72+
73+
It is ideal to implement features and fixes in the following order, and commit code after each step:
74+
75+
1. Write a minimal test case, or test cases, that demonstrate the bug or feature.
76+
1. Run the tests to ensure it fails (for a bug) or passes (for a feature). Then accept generated baselines (not applicable in the case of a crash).
77+
1. Implement the fix or feature.
78+
1. Run the tests again to ensure everything is working correctly. Accept the baselines.
79+
80+
It is fine to implement more and more of a feature across commits, but be sure to update baselines every time so that reviewers can measure progress.
81+
82+
# Other Instructions
83+
84+
- Do not add or change existing dependencies unless asked to.
85+

.github/workflows/ci.yml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ jobs:
3131
with:
3232
cache-name: build
3333

34+
# Avoid duplicate PR annotations.
35+
- name: Disable PR annotations
36+
run: |
37+
echo "::remove-matcher owner=eslint-compact::"
38+
echo "::remove-matcher owner=eslint-stylish::"
39+
echo "::remove-matcher owner=tsc::"
40+
echo "::remove-matcher owner=go::"
41+
3442
- run: npm ci
3543

3644
- run: npx hereby build
@@ -53,6 +61,7 @@ jobs:
5361
config:
5462
- os: ubuntu-latest
5563
coverage: true
64+
main: true
5665
- os: windows-latest
5766
coverage: true
5867
skip: ${{ github.event_name == 'merge_group' }}
@@ -106,6 +115,15 @@ jobs:
106115
with:
107116
cache-name: test
108117

118+
# Avoid duplicate PR annotations.
119+
- if: ${{ ! matrix.config.main }}
120+
name: Disable PR annotations
121+
run: |
122+
echo "::remove-matcher owner=eslint-compact::"
123+
echo "::remove-matcher owner=eslint-stylish::"
124+
echo "::remove-matcher owner=tsc::"
125+
echo "::remove-matcher owner=go::"
126+
109127
- run: npm ci
110128

111129
- run: go install gotest.tools/gotestsum@latest
@@ -128,7 +146,7 @@ jobs:
128146

129147
- run: git add .
130148

131-
- uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
149+
- uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
132150
if: ${{ always() && matrix.config.coverage && github.event_name != 'merge_group' }}
133151
with:
134152
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
@@ -155,10 +173,12 @@ jobs:
155173
matrix:
156174
config:
157175
- os: ubuntu-latest
176+
main: true
158177
- os: windows-latest
159178
skip: ${{ github.event_name == 'merge_group' }}
160-
- os: macos-latest
161-
skip: ${{ github.event_name == 'merge_group' }}
179+
# Skip macOS; we do not have any build tag'd files that require checking.
180+
# - os: macos-latest
181+
# skip: ${{ github.event_name == 'merge_group' }}
162182
- os: ubuntu-latest
163183
name: 'noembed'
164184
noembed: true
@@ -182,6 +202,15 @@ jobs:
182202
with:
183203
cache-name: lint${{ (matrix.config.noembed && '-noembed') || ''}}
184204

205+
# Avoid duplicate PR annotations.
206+
- if: ${{ ! matrix.config.main }}
207+
name: Disable PR annotations
208+
run: |
209+
echo "::remove-matcher owner=eslint-compact::"
210+
echo "::remove-matcher owner=eslint-stylish::"
211+
echo "::remove-matcher owner=tsc::"
212+
echo "::remove-matcher owner=go::"
213+
185214
- run: npm ci
186215

187216
- run: npx hereby lint
@@ -198,7 +227,6 @@ jobs:
198227

199228
- run: npm ci
200229

201-
- run: npx hereby install-tools
202230
- run: npx hereby check:format
203231

204232
generate:
@@ -208,6 +236,8 @@ jobs:
208236
with:
209237
submodules: true
210238
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
239+
with:
240+
node-version: '>=22.16.0'
211241
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
212242
- uses: ./.github/actions/setup-go
213243
with:
@@ -220,6 +250,12 @@ jobs:
220250
- run: node ./internal/lsp/lsproto/_generate/fetchModel.mjs
221251
- run: node ./internal/lsp/lsproto/_generate/generate.mjs
222252

253+
- name: Remove all converted fourslash tests
254+
run: rm -rf internal/fourslash/tests/gen
255+
256+
- name: Regenerate fourslash tests
257+
run: npm run convertfourslash
258+
223259
- run: git add .
224260
- run: git diff --staged --exit-code --stat
225261

@@ -246,6 +282,14 @@ jobs:
246282
with:
247283
cache-name: smoke
248284

285+
# Avoid duplicate PR annotations.
286+
- name: Disable PR annotations
287+
run: |
288+
echo "::remove-matcher owner=eslint-compact::"
289+
echo "::remove-matcher owner=eslint-stylish::"
290+
echo "::remove-matcher owner=tsc::"
291+
echo "::remove-matcher owner=go::"
292+
249293
- run: npm ci
250294

251295
- run: npx hereby build --race

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848

4949
# Initializes the CodeQL tools for scanning.
5050
- name: Initialize CodeQL
51-
uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
51+
uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
5252
with:
5353
config-file: ./.github/codeql/codeql-configuration.yml
5454
# Override language selection by uncommenting this and choosing your languages
@@ -58,7 +58,7 @@ jobs:
5858
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5959
# If this step fails, then you should remove it and run the build manually (see below).
6060
- name: Autobuild
61-
uses: github/codeql-action/autobuild@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
61+
uses: github/codeql-action/autobuild@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
6262

6363
# ℹ️ Command-line programs to run using the OS shell.
6464
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -72,4 +72,4 @@ jobs:
7272
# make release
7373

7474
- name: Perform CodeQL Analysis
75-
uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
75+
uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: 'Copilot Setup Steps'
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
7+
copilot-setup-steps:
8+
runs-on: ubuntu-latest
9+
10+
# Set the permissions to the lowest permissions possible needed for your steps.
11+
# Copilot will be given its own token for its operations.
12+
permissions:
13+
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
14+
contents: read
15+
16+
# You can define any steps you want, and they will run before the agent starts.
17+
# If you do not check out your code, Copilot will do this for you.
18+
steps:
19+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
with:
21+
submodules: true
22+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
23+
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
24+
- uses: ./.github/actions/setup-go
25+
with:
26+
cache-name: copilot-setup-steps
27+
- run: npm i -g @playwright/mcp@0.0.28
28+
- run: npm ci
29+
# pull dprint caches before network access is blocked
30+
- run: npx hereby check:format || true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,7 @@ custom-gcl.hash
194194
.idea
195195

196196
!testdata/submoduleAccepted.txt
197+
198+
!NOTICE.txt
199+
200+
!internal/fourslash/_scripts/failingTests.txt

.vscode/launch.template.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@
2828
"-test.run",
2929
"TestSubmodule/${fileBasename}"
3030
]
31+
},
32+
{
33+
"name": "Launch submodule test (with profiling)",
34+
"type": "go",
35+
"request": "launch",
36+
"mode": "test",
37+
"program": "${workspaceFolder}/internal/testrunner",
38+
"args": [
39+
"-test.cpuprofile",
40+
"${workspaceFolder}/test.prof",
41+
"-test.run",
42+
"TestSubmodule/${fileBasename}"
43+
]
44+
},
45+
{
46+
"name": "Launch fourslash test",
47+
"type": "go",
48+
"request": "launch",
49+
"mode": "test",
50+
"program": "${workspaceFolder}/internal/fourslash/gen/${fileBasename}"
3151
}
3252
]
3353
}

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{
1818
"label": "Watch",
1919
"type": "npm",
20-
"script": "build:watch",
20+
"script": "build:watch:debug",
2121
"group": "build",
2222
"presentation": {
2323
"panel": "dedicated",

0 commit comments

Comments
 (0)