Skip to content

Commit 39dc89c

Browse files
committed
Merge main into deno-tsgo
2 parents 225c766 + 688c31d commit 39dc89c

File tree

1,366 files changed

+85023
-7547
lines changed

Some content is hidden

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

1,366 files changed

+85023
-7547
lines changed

_extension/src/commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as vscode from "vscode";
22
import { Client } from "./client";
3+
import { restartExtHostOnChangeIfNeeded } from "./util";
34

45
export function registerEnablementCommands(context: vscode.ExtensionContext): void {
56
context.subscriptions.push(vscode.commands.registerCommand("typescript.native-preview.enable", () => {
@@ -50,7 +51,7 @@ async function updateUseTsgoSetting(enable: boolean): Promise<void> {
5051
}
5152
// Update the setting and restart the extension host (needed to change the state of the built-in TS extension)
5253
await tsConfig.update("experimental.useTsgo", enable, target);
53-
await vscode.commands.executeCommand("workbench.action.restartExtensionHost");
54+
await restartExtHostOnChangeIfNeeded();
5455
}
5556

5657
/**

_extension/src/extension.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
registerLanguageCommands,
77
} from "./commands";
88
import { setupStatusBar } from "./statusBar";
9+
import { needsExtHostRestartOnChange } from "./util";
910
import { setupVersionStatusItem } from "./versionStatusItem";
1011

1112
export async function activate(context: vscode.ExtensionContext) {
@@ -15,14 +16,11 @@ export async function activate(context: vscode.ExtensionContext) {
1516
const traceOutput = vscode.window.createOutputChannel("typescript-native-preview (LSP)");
1617
context.subscriptions.push(output, traceOutput);
1718

18-
const majorVersion = parseInt(vscode.version.split(".")[0]);
19-
const minorVersion = parseInt(vscode.version.split(".")[1]);
20-
const needsExtHostRestartOnChange = majorVersion <= 1 && minorVersion < 105;
2119
let disposeLanguageFeatures: vscode.Disposable | undefined;
2220

2321
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(async event => {
2422
if (event.affectsConfiguration("typescript.experimental.useTsgo")) {
25-
if (needsExtHostRestartOnChange) {
23+
if (needsExtHostRestartOnChange()) {
2624
// Delay because the command to change the config setting will restart
2725
// the extension host, so no need to show a message
2826
setTimeout(async () => {

_extension/src/util.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,15 @@ export function getLanguageForUri(uri: vscode.Uri): string | undefined {
8989
return undefined;
9090
}
9191
}
92+
93+
export function needsExtHostRestartOnChange() {
94+
const majorVersion = parseInt(vscode.version.split(".")[0]);
95+
const minorVersion = parseInt(vscode.version.split(".")[1]);
96+
return majorVersion <= 1 && minorVersion < 105;
97+
}
98+
99+
export async function restartExtHostOnChangeIfNeeded(): Promise<void> {
100+
if (needsExtHostRestartOnChange()) {
101+
await vscode.commands.executeCommand("workbench.action.restartExtensionHost");
102+
}
103+
}

_submodules/TypeScript

Submodule TypeScript updated 1509 files

internal/ast/ast.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10730,10 +10730,10 @@ type SourceFile struct {
1073010730
ClassifiableNames collections.Set[string]
1073110731
PatternAmbientModules []*PatternAmbientModule
1073210732

10733-
// Fields set by LineMap
10733+
// Fields set by ECMALineMap
1073410734

10735-
lineMapMu sync.RWMutex
10736-
lineMap []core.TextPos
10735+
ecmaLineMapMu sync.RWMutex
10736+
ecmaLineMap []core.TextPos
1073710737

1073810738
// Fields set by language service
1073910739

@@ -10869,17 +10869,17 @@ func (f *NodeFactory) UpdateSourceFile(node *SourceFile, statements *StatementLi
1086910869
return node.AsNode()
1087010870
}
1087110871

10872-
func (node *SourceFile) LineMap() []core.TextPos {
10873-
node.lineMapMu.RLock()
10874-
lineMap := node.lineMap
10875-
node.lineMapMu.RUnlock()
10872+
func (node *SourceFile) ECMALineMap() []core.TextPos {
10873+
node.ecmaLineMapMu.RLock()
10874+
lineMap := node.ecmaLineMap
10875+
node.ecmaLineMapMu.RUnlock()
1087610876
if lineMap == nil {
10877-
node.lineMapMu.Lock()
10878-
defer node.lineMapMu.Unlock()
10879-
lineMap = node.lineMap
10877+
node.ecmaLineMapMu.Lock()
10878+
defer node.ecmaLineMapMu.Unlock()
10879+
lineMap = node.ecmaLineMap
1088010880
if lineMap == nil {
10881-
lineMap = core.ComputeLineStarts(node.Text())
10882-
node.lineMap = lineMap
10881+
lineMap = core.ComputeECMALineStarts(node.Text())
10882+
node.ecmaLineMap = lineMap
1088310883
}
1088410884
}
1088510885
return lineMap
@@ -11061,7 +11061,7 @@ func getDeclarationName(declaration *Node) string {
1106111061

1106211062
type SourceFileLike interface {
1106311063
Text() string
11064-
LineMap() []core.TextPos
11064+
ECMALineMap() []core.TextPos
1106511065
}
1106611066

1106711067
type CommentRange struct {

internal/astnav/tokens_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func tsGetTouchingPropertyName(t testing.TB, fileText string, positions []int) [
240240
}
241241

242242
func writeRangeDiff(output *strings.Builder, file *ast.SourceFile, diff tokenDiff, rng core.TextRange, position int) {
243-
lines := file.LineMap()
243+
lines := file.ECMALineMap()
244244

245245
tsTokenPos := position
246246
goTokenPos := position

internal/bundled/embed_generated.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)