Skip to content

Commit 3f43d34

Browse files
authored
Merge branch 'main' into copilot/fix-1011
2 parents 8418cce + 6e03d62 commit 3f43d34

File tree

8,792 files changed

+92744
-335839
lines changed

Some content is hidden

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

8,792 files changed

+92744
-335839
lines changed

.dprint.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
// Note: if adding new languages, make sure settings.template.json is updated too.
6060
// Also, if updating typescript, update the one in package.json.
6161
"plugins": [
62-
"https://plugins.dprint.dev/typescript-0.95.5.wasm",
62+
"https://plugins.dprint.dev/typescript-0.95.7.wasm",
6363
"https://plugins.dprint.dev/json-0.20.0.wasm",
6464
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm",
6565
"https://plugins.dprint.dev/exec-0.5.1.json@492414e39dea4dccc07b4af796d2f4efdb89e84bae2bd4e1e924c0cc050855bf"

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ jobs:
176176
main: true
177177
- os: windows-latest
178178
skip: ${{ github.event_name == 'merge_group' }}
179-
- os: macos-latest
180-
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' }}
181182
- os: ubuntu-latest
182183
name: 'noembed'
183184
noembed: true
@@ -235,6 +236,8 @@ jobs:
235236
with:
236237
submodules: true
237238
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
239+
with:
240+
node-version: '>=22.16.0'
238241
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
239242
- uses: ./.github/actions/setup-go
240243
with:
@@ -247,6 +250,12 @@ jobs:
247250
- run: node ./internal/lsp/lsproto/_generate/fetchModel.mjs
248251
- run: node ./internal/lsp/lsproto/_generate/generate.mjs
249252

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+
250259
- run: git add .
251260
- run: git diff --staged --exit-code --stat
252261

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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

NOTICE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
264264

265265
---------------------------------------------------------
266266

267-
golang.org/x/sync v0.14.0 - BSD-3-Clause
267+
golang.org/x/sync v0.15.0 - BSD-3-Clause
268268

269269
Copyright 2009 The Go Authors.
270270

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Preview
66

7-
A preview build is available on npm as `@typescript/native-preview`.
7+
A preview build is available on npm as [`@typescript/native-preview`](https://www.npmjs.com/package/@typescript/native-preview).
88

99
```sh
1010
npm install @typescript/native-preview

_packages/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@
4646
},
4747
"dependencies": {
4848
"@typescript/ast": "1.0.0",
49-
"libsyncrpc": "github:microsoft/libsyncrpc#bb02d84"
49+
"@typescript/libsyncrpc": "github:microsoft/libsyncrpc#8cdae454cc482536c5844bef83b796f95464da85"
5050
}
5151
}

_packages/api/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SyncRpcChannel } from "libsyncrpc";
1+
import { SyncRpcChannel } from "@typescript/libsyncrpc";
22
import type { FileSystem } from "./fs.ts";
33

44
export interface ClientOptions {

_submodules/TypeScript

Submodule TypeScript updated 8311 files

_tools/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/microsoft/typescript-go/_tools
33
go 1.24.0
44

55
require (
6-
github.com/golangci/plugin-module-register v0.1.2-0.20250519122030-95854f10c778
7-
golang.org/x/mod v0.24.0
8-
golang.org/x/tools v0.33.0
6+
github.com/golangci/plugin-module-register v0.1.2
7+
golang.org/x/mod v0.25.0
8+
golang.org/x/tools v0.34.0
99
gotest.tools/v3 v3.5.2
1010
)
1111

1212
require (
1313
github.com/google/go-cmp v0.6.0 // indirect
14-
golang.org/x/sync v0.14.0 // indirect
14+
golang.org/x/sync v0.15.0 // indirect
1515
)

_tools/go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
github.com/golangci/plugin-module-register v0.1.2-0.20250519122030-95854f10c778 h1:a5T2fJwhfuTPuhCau4IPP4ZGGndS/ysLzDorg1mA2P4=
2-
github.com/golangci/plugin-module-register v0.1.2-0.20250519122030-95854f10c778/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw=
1+
github.com/golangci/plugin-module-register v0.1.2 h1:e5WM6PO6NIAEcij3B053CohVp3HIYbzSuP53UAYgOpg=
2+
github.com/golangci/plugin-module-register v0.1.2/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw=
33
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
44
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
5-
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
6-
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
7-
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
8-
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
9-
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
10-
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
5+
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
6+
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
7+
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
8+
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
9+
golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo=
10+
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg=
1111
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
1212
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ require (
77
github.com/go-json-experiment/json v0.0.0-20250517221953-25912455fbc8
88
github.com/google/go-cmp v0.7.0
99
github.com/peter-evans/patience v0.3.0
10-
golang.org/x/sync v0.14.0
10+
golang.org/x/sync v0.15.0
1111
golang.org/x/sys v0.33.0
1212
gotest.tools/v3 v3.5.2
1313
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t
2020
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
2121
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
2222
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
23-
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
24-
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
23+
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
24+
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
2525
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
2626
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
2727
golang.org/x/tools v0.32.0 h1:Q7N1vhpkQv7ybVzLFtTjvQya2ewbwNDZzUgfXGqtMWU=

internal/api/api.go

Lines changed: 23 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ type API struct {
2929
host APIHost
3030
options APIOptions
3131

32-
documentRegistry *project.DocumentRegistry
33-
scriptInfosMu sync.RWMutex
34-
scriptInfos map[tspath.Path]*project.ScriptInfo
32+
documentStore *project.DocumentStore
33+
configFileRegistry *project.ConfigFileRegistry
3534

3635
projects handleMap[project.Project]
3736
filesMu sync.Mutex
@@ -46,16 +45,16 @@ var _ project.ProjectHost = (*API)(nil)
4645

4746
func NewAPI(host APIHost, options APIOptions) *API {
4847
api := &API{
49-
host: host,
50-
options: options,
51-
scriptInfos: make(map[tspath.Path]*project.ScriptInfo),
52-
projects: make(handleMap[project.Project]),
53-
files: make(handleMap[ast.SourceFile]),
54-
symbols: make(handleMap[ast.Symbol]),
55-
types: make(handleMap[checker.Type]),
48+
host: host,
49+
options: options,
50+
projects: make(handleMap[project.Project]),
51+
files: make(handleMap[ast.SourceFile]),
52+
symbols: make(handleMap[ast.Symbol]),
53+
types: make(handleMap[checker.Type]),
5654
}
57-
api.documentRegistry = &project.DocumentRegistry{
58-
Options: tspath.ComparePathsOptions{
55+
56+
api.documentStore = project.NewDocumentStore(project.DocumentStoreOptions{
57+
ComparePathsOptions: tspath.ComparePathsOptions{
5958
UseCaseSensitiveFileNames: host.FS().UseCaseSensitiveFileNames(),
6059
CurrentDirectory: host.GetCurrentDirectory(),
6160
},
@@ -64,6 +63,10 @@ func NewAPI(host APIHost, options APIOptions) *API {
6463
_ = api.releaseHandle(string(FileHandle(file)))
6564
},
6665
},
66+
})
67+
68+
api.configFileRegistry = &project.ConfigFileRegistry{
69+
Host: api,
6770
}
6871
return api
6972
}
@@ -78,9 +81,14 @@ func (api *API) TypingsInstaller() *project.TypingsInstaller {
7881
return nil
7982
}
8083

81-
// DocumentRegistry implements ProjectHost.
82-
func (api *API) DocumentRegistry() *project.DocumentRegistry {
83-
return api.documentRegistry
84+
// DocumentStore implements ProjectHost.
85+
func (api *API) DocumentStore() *project.DocumentStore {
86+
return api.documentStore
87+
}
88+
89+
// ConfigFileRegistry implements ProjectHost.
90+
func (api *API) ConfigFileRegistry() *project.ConfigFileRegistry {
91+
return api.configFileRegistry
8492
}
8593

8694
// FS implements ProjectHost.
@@ -93,23 +101,6 @@ func (api *API) GetCurrentDirectory() string {
93101
return api.host.GetCurrentDirectory()
94102
}
95103

96-
// GetOrCreateScriptInfoForFile implements ProjectHost.
97-
func (api *API) GetOrCreateScriptInfoForFile(fileName string, path tspath.Path, scriptKind core.ScriptKind) *project.ScriptInfo {
98-
return api.getOrCreateScriptInfo(fileName, path, scriptKind)
99-
}
100-
101-
// GetScriptInfoByPath implements ProjectHost.
102-
func (api *API) GetScriptInfoByPath(path tspath.Path) *project.ScriptInfo {
103-
api.scriptInfosMu.RLock()
104-
defer api.scriptInfosMu.RUnlock()
105-
return api.scriptInfos[path]
106-
}
107-
108-
// OnDiscoveredSymlink implements ProjectHost.
109-
func (api *API) OnDiscoveredSymlink(info *project.ScriptInfo) {
110-
// !!!
111-
}
112-
113104
// Log implements ProjectHost.
114105
func (api *API) Log(s string) {
115106
api.options.Logger.Info(s)
@@ -366,26 +357,6 @@ func (api *API) releaseHandle(handle string) error {
366357
return nil
367358
}
368359

369-
func (api *API) getOrCreateScriptInfo(fileName string, path tspath.Path, scriptKind core.ScriptKind) *project.ScriptInfo {
370-
api.scriptInfosMu.RLock()
371-
info, ok := api.scriptInfos[path]
372-
api.scriptInfosMu.RUnlock()
373-
if ok {
374-
return info
375-
}
376-
377-
content, ok := api.host.FS().ReadFile(fileName)
378-
if !ok {
379-
return nil
380-
}
381-
info = project.NewScriptInfo(fileName, path, scriptKind, api.host.FS())
382-
info.SetTextFromDisk(content)
383-
api.scriptInfosMu.Lock()
384-
defer api.scriptInfosMu.Unlock()
385-
api.scriptInfos[path] = info
386-
return info
387-
}
388-
389360
func (api *API) toAbsoluteFileName(fileName string) string {
390361
return tspath.GetNormalizedAbsolutePath(fileName, api.host.GetCurrentDirectory())
391362
}

internal/api/encoder/encoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ func getChildrenPropertyMask(node *ast.Node) uint8 {
686686
return (boolToByte(n.TagName != nil) << 0) | (boolToByte(n.TypeExpression != nil) << 1) | (boolToByte(n.Name() != nil) << 2) | (boolToByte(n.Comment != nil) << 3)
687687
case ast.KindJSDocSignature:
688688
n := node.AsJSDocSignature()
689-
return (boolToByte(n.TypeParameters() != nil) << 0) | (boolToByte(n.Parameters != nil) << 1) | (boolToByte(n.Type != nil) << 2)
689+
return (boolToByte(n.TypeParameters != nil) << 0) | (boolToByte(n.Parameters != nil) << 1) | (boolToByte(n.Type != nil) << 2)
690690
case ast.KindClassStaticBlockDeclaration:
691691
n := node.AsClassStaticBlockDeclaration()
692692
return (boolToByte(n.Modifiers() != nil) << 0) | (boolToByte(n.Body != nil) << 1)

internal/api/encoder/encoder_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ import (
1313
"github.com/microsoft/typescript-go/internal/core"
1414
"github.com/microsoft/typescript-go/internal/parser"
1515
"github.com/microsoft/typescript-go/internal/repo"
16-
"github.com/microsoft/typescript-go/internal/scanner"
1716
"github.com/microsoft/typescript-go/internal/testutil/baseline"
1817
"gotest.tools/v3/assert"
1918
)
2019

2120
func TestEncodeSourceFile(t *testing.T) {
2221
t.Parallel()
23-
sourceFile := parser.ParseSourceFile("/test.ts", "/test.ts", "import { bar } from \"bar\";\nexport function foo<T, U>(a: string, b: string): any {}\nfoo();", core.ScriptTargetESNext, scanner.JSDocParsingModeParseAll)
22+
sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{
23+
FileName: "/test.ts",
24+
Path: "/test.ts",
25+
}, "import { bar } from \"bar\";\nexport function foo<T, U>(a: string, b: string): any {}\nfoo();", core.ScriptKindTS)
2426
t.Run("baseline", func(t *testing.T) {
2527
t.Parallel()
2628
buf, err := encoder.EncodeSourceFile(sourceFile, "")
@@ -38,13 +40,10 @@ func BenchmarkEncodeSourceFile(b *testing.B) {
3840
filePath := filepath.Join(repo.TypeScriptSubmodulePath, "src/compiler/checker.ts")
3941
fileContent, err := os.ReadFile(filePath)
4042
assert.NilError(b, err)
41-
sourceFile := parser.ParseSourceFile(
42-
"/checker.ts",
43-
"/checker.ts",
44-
string(fileContent),
45-
core.ScriptTargetESNext,
46-
scanner.JSDocParsingModeParseAll,
47-
)
43+
sourceFile := parser.ParseSourceFile(ast.SourceFileParseOptions{
44+
FileName: "/checker.ts",
45+
Path: "/checker.ts",
46+
}, string(fileContent), core.ScriptKindTS)
4847

4948
for b.Loop() {
5049
_, err := encoder.EncodeSourceFile(sourceFile, "")

0 commit comments

Comments
 (0)