Skip to content

Commit be02da0

Browse files
committed
Merge remote-tracking branch 'origin/main' into organize-imports
2 parents fc0e955 + 5c96b7e commit be02da0

File tree

438 files changed

+12719
-7568
lines changed

Some content is hidden

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

438 files changed

+12719
-7568
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
swap-storage: false
3232
dotnet: false
3333
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
34-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
34+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
3535
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
3636
- uses: ./.github/actions/setup-go
3737

@@ -51,7 +51,7 @@ jobs:
5151
runs-on: ubuntu-latest
5252
steps:
5353
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
54-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
54+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
5555
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
5656

5757
- run: npm ci
@@ -71,7 +71,8 @@ jobs:
7171
skip: ${{ github.event_name == 'merge_group' }}
7272
- os: macos-latest
7373
coverage: true
74-
skip: ${{ github.event_name == 'merge_group' }}
74+
# There aren't enough macOS runners; skip in PRs and rely on main branch runs.
75+
skip: ${{ github.event_name == 'merge_group' || github.event_name == 'pull_request' }}
7576
- os: ubuntu-latest
7677
name: 'no submodules'
7778
no-submodules: true
@@ -118,7 +119,7 @@ jobs:
118119
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
119120
with:
120121
submodules: ${{ !matrix.config.no-submodules }}
121-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
122+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
122123
with:
123124
node-version: 'lts/*'
124125
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
@@ -211,7 +212,7 @@ jobs:
211212
swap-storage: false
212213
dotnet: false
213214
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
214-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
215+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
215216
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
216217
- uses: ./.github/actions/setup-go
217218
with:
@@ -234,7 +235,7 @@ jobs:
234235
runs-on: ubuntu-latest
235236
steps:
236237
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
237-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
238+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
238239
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
239240
- uses: ./.github/actions/setup-go
240241

@@ -254,7 +255,7 @@ jobs:
254255
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
255256
with:
256257
submodules: true
257-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
258+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
258259
with:
259260
node-version: '>=22.16.0'
260261
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
@@ -301,7 +302,7 @@ jobs:
301302
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
302303
with:
303304
submodules: true
304-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
305+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
305306
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
306307
- uses: ./.github/actions/setup-go
307308

@@ -343,7 +344,7 @@ jobs:
343344
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
344345
with:
345346
submodules: true
346-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
347+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
347348
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
348349
- uses: ./.github/actions/setup-go
349350

.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@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
51+
uses: github/codeql-action/init@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10
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@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
61+
uses: github/codeql-action/autobuild@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10
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@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
75+
uses: github/codeql-action/analyze@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2626
with:
2727
submodules: true
28-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
28+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
2929
with:
3030
node-version: '>=22.16.0'
3131
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable

.github/workflows/create-cache.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
4747
with:
4848
submodules: true
49-
- uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
49+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
5050
- uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
5151

5252
- uses: ./.github/actions/setup-go

.vscode/tasks.json

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,28 @@
4949
"reveal": "never"
5050
},
5151
"problemMatcher": [
52-
"$tsc"
52+
"$tsc",
53+
// Copy-paste from https://github.com/connor4312/esbuild-problem-matchers to avoid the extension dependency
54+
{
55+
"owner": "esbuild",
56+
"severity": "error",
57+
"applyTo": "closedDocuments",
58+
"source": "esbuild",
59+
"fileLocation": "relative",
60+
"pattern": [
61+
{
62+
"regexp": "^[✘▲] \\[([A-Z]+)\\] (.+)",
63+
"severity": 1,
64+
"message": 2
65+
},
66+
{
67+
"regexp": "^(?:\\t| {4})(?!\\s)([^:]+)(?::([0-9]+))?(?::([0-9]+))?:$",
68+
"file": 1,
69+
"line": 2,
70+
"column": 3
71+
}
72+
]
73+
}
5374
]
5475
},
5576
{
@@ -65,9 +86,36 @@
6586
"panel": "dedicated",
6687
"reveal": "never"
6788
},
68-
"problemMatcher": [
69-
"$tsc-watch"
70-
]
89+
// Copy-paste from https://github.com/connor4312/esbuild-problem-matchers to avoid the extension dependency
90+
"problemMatcher": {
91+
"owner": "esbuild-watch",
92+
"severity": "error",
93+
"applyTo": "closedDocuments",
94+
"source": "esbuild",
95+
"fileLocation": "relative",
96+
"pattern": [
97+
{
98+
"regexp": "^[✘▲] \\[([A-Z]+)\\] (.+)",
99+
"severity": 1,
100+
"message": 2
101+
},
102+
{
103+
"regexp": "^(?:\\t| {4})(?!\\s)([^:]+)(?::([0-9]+))?(?::([0-9]+))?:$",
104+
"file": 1,
105+
"line": 2,
106+
"column": 3
107+
}
108+
],
109+
"background": {
110+
"activeOnStart": true,
111+
"beginsPattern": {
112+
"regexp": "\\[watch\\] build started"
113+
},
114+
"endsPattern": {
115+
"regexp": "\\[watch\\] build finished"
116+
}
117+
}
118+
}
71119
},
72120
{
73121
"label": "Watch for extension run",

CONTRIBUTING.md

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

33
## How to Build and Run
44

5-
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).
5+
This repo uses [Go 1.25 or higher](https://go.dev/dl/), [Rust 1.88 or higher](https://www.rust-lang.org/tools/install), [Node.js with npm](https://nodejs.org/), and [`hereby`](https://www.npmjs.com/package/hereby).
66

77
For tests and code generation, this repo contains a git submodule to the main TypeScript repo pointing to the commit being ported.
88
When cloning, you'll want to clone with submodules:

Herebyfile.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,8 @@ export const packNativePreviewExtensions = task({
13071307
await rimraf(builtVsix);
13081308
await fs.promises.mkdir(builtVsix, { recursive: true });
13091309

1310-
await $({ cwd: extensionDir })`npm run bundle`;
1310+
// We don't use vscode:prepublish, as that would run the build for each package below.
1311+
await $({ cwd: extensionDir })`npm run bundle:release`;
13111312

13121313
let version = "0.0.0";
13131314
if (options.forRelease) {
@@ -1341,7 +1342,6 @@ export const packNativePreviewExtensions = task({
13411342
const packageJsonPath = path.join(thisExtensionDir, "package.json");
13421343
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
13431344
packageJson.version = version;
1344-
packageJson.main = "dist/extension.bundle.js";
13451345
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, undefined, 4));
13461346

13471347
await fs.promises.copyFile("NOTICE.txt", path.join(thisExtensionDir, "NOTICE.txt"));

_extension/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
}
145145
]
146146
},
147-
"main": "./dist/extension.js",
147+
"main": "./dist/extension.bundle.js",
148148
"files": [
149149
"dist/extension.bundle.js",
150150
"lib",
@@ -153,9 +153,11 @@
153153
"logo.png"
154154
],
155155
"scripts": {
156-
"build": "tsc",
157-
"watch": "tsc --watch",
158-
"bundle": "esbuild src/extension.ts --bundle --external:vscode --platform=node --format=cjs --outfile=dist/extension.bundle.js --minify"
156+
"build": "tsc && npm run bundle",
157+
"bundle": "esbuild src/extension.ts --bundle --external:vscode --platform=node --format=cjs --outfile=dist/extension.bundle.js --sourcemap",
158+
"watch": "npm run bundle -- --watch",
159+
"//vscode:prepublish": "we do not use this hook; the Herebyfile runs bundle:release once instead",
160+
"bundle:release": "npm run bundle -- --minify"
159161
},
160162
"dependencies": {
161163
"vscode-languageclient": "^10.0.0-next.19"

_extension/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"strict": true,
99
"skipLibCheck": true,
1010
"resolveJsonModule": true,
11-
"sourceMap": true
11+
"sourceMap": true,
12+
"noEmit": true
1213
},
1314
"include": ["./src/**/*"]
1415
}

cmd/tsgo/lsp.go

Lines changed: 7 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -71,68 +71,16 @@ func runLSP(args []string) int {
7171
}
7272

7373
func getGlobalTypingsCacheLocation() string {
74-
switch runtime.GOOS {
75-
case "windows":
76-
return tspath.CombinePaths(tspath.CombinePaths(getWindowsCacheLocation(), "Microsoft/TypeScript"), core.VersionMajorMinor())
77-
case "openbsd", "freebsd", "netbsd", "darwin", "linux", "android":
78-
return tspath.CombinePaths(tspath.CombinePaths(getNonWindowsCacheLocation(), "typescript"), core.VersionMajorMinor())
79-
default:
80-
panic("unsupported platform: " + runtime.GOOS)
81-
}
82-
}
83-
84-
func getWindowsCacheLocation() string {
85-
basePath, err := os.UserCacheDir()
74+
cacheDir, err := os.UserCacheDir()
8675
if err != nil {
87-
if basePath, err = os.UserConfigDir(); err != nil {
88-
if basePath, err = os.UserHomeDir(); err != nil {
89-
if userProfile := os.Getenv("USERPROFILE"); userProfile != "" {
90-
basePath = userProfile
91-
} else if homeDrive, homePath := os.Getenv("HOMEDRIVE"), os.Getenv("HOMEPATH"); homeDrive != "" && homePath != "" {
92-
basePath = homeDrive + homePath
93-
} else {
94-
basePath = os.TempDir()
95-
}
96-
}
97-
}
76+
cacheDir = os.TempDir()
9877
}
99-
return basePath
100-
}
10178

102-
func getNonWindowsCacheLocation() string {
103-
if xdgCacheHome := os.Getenv("XDG_CACHE_HOME"); xdgCacheHome != "" {
104-
return xdgCacheHome
105-
}
106-
const platformIsDarwin = runtime.GOOS == "darwin"
107-
var usersDir string
108-
if platformIsDarwin {
109-
usersDir = "Users"
110-
} else {
111-
usersDir = "home"
112-
}
113-
homePath, err := os.UserHomeDir()
114-
if err != nil {
115-
if home := os.Getenv("HOME"); home != "" {
116-
homePath = home
117-
} else {
118-
var userName string
119-
if logName := os.Getenv("LOGNAME"); logName != "" {
120-
userName = logName
121-
} else if user := os.Getenv("USER"); user != "" {
122-
userName = user
123-
}
124-
if userName != "" {
125-
homePath = "/" + usersDir + "/" + userName
126-
} else {
127-
homePath = os.TempDir()
128-
}
129-
}
130-
}
131-
var cacheFolder string
132-
if platformIsDarwin {
133-
cacheFolder = "Library/Caches"
79+
var subdir string
80+
if runtime.GOOS == "windows" {
81+
subdir = "Microsoft/TypeScript"
13482
} else {
135-
cacheFolder = ".cache"
83+
subdir = "typescript"
13684
}
137-
return tspath.CombinePaths(homePath, cacheFolder)
85+
return tspath.CombinePaths(cacheDir, subdir, core.VersionMajorMinor())
13886
}

0 commit comments

Comments
 (0)