Skip to content

Commit dc65ebf

Browse files
committed
Merge remote-tracking branch 'upstream/main' into preserve-inferred-ata
# Conflicts: # tsc/internal/project/project.go # tsc/internal/project/projectcollection.go # tsc/internal/project/projectcollectionbuilder.go # tsc/internal/project/session.go
2 parents 40f67b5 + f9f8d01 commit dc65ebf

1,885 files changed

Lines changed: 336255 additions & 25411 deletions

File tree

Some content is hidden

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

‎.dprint.jsonc‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"**/testdata",
4949
"packages/vscode-typescript/l10n/**",
5050
"tsc/internal/bundled/libs/**",
51-
"tsc/internal/lsp/lsproto/_generate/*.json",
52-
"tsc/internal/lsp/lsproto/_generate/metaModelSchema.mts",
51+
"tools/scripts/lsp/*.json",
52+
"tools/scripts/lsp/metaModelSchema.mts",
5353
// Needs to be LF to have a working shebang.
5454
"packages/typescript/bin/tsc",
5555
"tsc/internal/bundled/source/**",

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ runs:
1515
go-version: ${{ inputs.go-version }}
1616
go-download-base-url: https://aka.ms/golang/release/latest
1717
cache: false
18+
19+
- name: Cache Go modules
20+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
21+
with:
22+
path: ~/go/pkg/mod
23+
key: go-modules-${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ inputs.go-version }}-${{ hashFiles('**/go.mod', '**/go.sum', 'go.work', 'go.work.sum', '.custom-gcl.yml') }}

‎.github/skills/api-client/SKILL.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,21 @@ If the method is an operation on a single `Type` or `Symbol` that takes no other
3434
## Unnecessary spread and `exactOptionalPropertyTypes`
3535

3636
Never write code like `...(options ? { snapshot: options.snapshot } : {})`. All optional properties should tolerate `undefined`. If `--exactOptionalPropertyTypes` is forcing you to write code this way, fix the offending type. Rewriting as `if (options) foo.snapshot = options.snapshot` is not an acceptable workaround; always fix the type. As a rule, object types used in input positions should always define optional properties with `prop?: T | undefined` so this isn't a problem.
37+
38+
## What kinds of ID collisions matter?
39+
40+
Most API objects synchronize their client and server identities by some kind of handle or ID. Some care has to be taken when choosing an ID scheme.
41+
42+
What matters:
43+
44+
* A single `api.Session` in LSP mode can have multiple simultaneous clients. Sometimes those clients will all talk about the same server object. Other times, a single client needs to create objects that are private to it, like resolution contexts or source file leases. In those cases, the server must generate the unique ID after creation to avoid ID collision of private objects between multiple clients.
45+
46+
47+
What doesn't matter:
48+
49+
* `uint64` overflow
50+
* Passing objects between multiple `API` instances in the same JS process. We may eventually add some kind of central provenance validation. Do not add it on individual methods or flag it in reviews for now. It's not a realistic concern.
51+
52+
## Reference equality guarantees are forfeited by disposing owners and clearing the source file cache
53+
54+
It's not a bug to observe a new object identity for an object whose owner was previously disposed or manually removed by `api.clearSourceFileCache()`. Review comments and tests that assert an ownership or lifetime bug that rely on testing reference equality after disposal or cache clearing will be rejected.
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
---
2-
name: restack
2+
name: mcfly
33
description: Only invoke when explicitly instructed to
44
---
55

66
You need to "re-stack" your commits to match the following format:
7-
* A failing test case
7+
* Testcase(s), including at least one that demonstrate the problem - this could be a test that directly fails, baselines that show the problem, or even both
88
* A commit, or series of commits, that fixes the failing test case
9-
* (Optional) a follow-up commit that checks in any modified baselines
9+
* If needed, a follow-up commit with modified baselines
1010

1111
Since you can't force-push, start with a commit that undoes all your prior changes and gets you back to `main`.
1212

1313
Then add your test case(s) in a single commit.
14+
When you add testcases that create or modify baselines, commit the (pre-fix) baselines at the same time as the testcases themselves.
1415
A test case isn't necessarily a new file; it could be a modification to an existing test or a change in the test configuration.
1516
Ensure that at least one test in the full run fails - you might be operating on a bad PR that didn't actually introduce a failing scenario!
1617
If zero tests failed, abort and post a message explaining what you observed.
1718
Remember that baseline tests do not "fail" in the traditional sense; they are used to verify that the output matches the expected baseline.
18-
You should examine the PR description to determine what the desired passing baseline should look like.
19+
Ensure that your test demonstrates the problem that the PR is intended to fix.
1920

2021
Then, add your fix.
2122
You can break this apart into multiple commits if it's more logical to review that way; use your judgment.
@@ -25,4 +26,4 @@ Do not accept baseline diffs yet!
2526

2627
Finally, if there are baseline diffs, commit those in a separate commit.
2728

28-
Ensure that the final diff you have matches the original diff you started with; this process should not introduce any unintended changes.
29+
Ensure that the final diff you have matches the original diff you started with, as this process should not introduce any unintended changes.

‎.github/skills/security-report-check/SKILL.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ If this file is modified, it can cause `tsc` to e.g. fail to build a file becaus
8484
The TypeScript Language Service (LS) only executes in the context of a [trusted workspace (VS Code)](https://code.visualstudio.com/docs/editing/workspaces/workspace-trust) or [trusted folder (VS)](https://learn.microsoft.com/en-us/visualstudio/ide/trust-settings?view=visualstudio).
8585
Similar to tsc, there are no guaranteed resource caps in the LS, and "hangs" may occur in the presence of adversarial inputs.
8686

87+
### Workspace Trust is Your Responsibility
88+
89+
Remember the definition of Workspace Trust (emphasis added):
90+
91+
> The Workspace Trust feature lets you decide whether **code in your project** folder can be **executed** by VS Code and extensions **without your explicit approval**.
92+
93+
Features like Content Mappers, including when they come from `node_modules`, are part of this "code in your project" and will run if you trust a workspace containing them.
94+
This also includes TypeScript itself if you have enabled using the workspace version of TypeScript (again e.g. from `node_modules`).
95+
The TypeScript Language Service doesn't provide additional barriers to this execution.
96+
Remember to only enable Workspace Trust for workspaces that you trust, i.e. are willing to run code from.
97+
98+
### Go Compiler CVEs
99+
100+
The Go compiler is frequently updated to address CVEs in its core components and standard library.
101+
These normally do not affect TypeScript - for example, a CVE in Go's HTTP library is not reachable from tsc, so is not relevant to TypeScript security.
102+
We do not issue patch releases of TypeScript to adopt newer versions of Go **unless** there is an identified path to a particular CVE.
103+
We recommend using `govulncheck` instead of a blanket version-based scan to identify potential issues.
104+
87105
## Examples
88106

89107
### Hypothetically Valid Security Reports

‎.github/workflows/bump-vscode-typescript.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
npm version "$BUMP" \
6161
--workspace native-preview \
6262
--no-git-tag-version \
63+
--package-lock-only
6364
6465
packageVersion="$(jq -r '.version' packages/vscode-typescript/package.json)"
6566
lockVersion="$(jq -r '.packages["packages/vscode-typescript"].version' package-lock.json)"

‎.github/workflows/ci.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ jobs:
280280
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
281281
with:
282282
node-version: 'lts/*'
283-
- uses: ./.github/actions/setup-go
284283
- run: npm ci
285284
- run: npx hereby check:format
286285

‎.golangci.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ linters:
6868
depguard:
6969
rules:
7070
main:
71+
files:
72+
- '**/tsc/**/*.go'
7173
deny:
7274
- pkg: 'encoding/json$'
7375
desc: 'Use "github.com/microsoft/TypeScript/tsc/internal/json" instead.'

0 commit comments

Comments
 (0)