Skip to content

Commit efbf3b5

Browse files
Enable JSX auto-insert in content-mapped files (#64572)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
1 parent a4b1410 commit efbf3b5

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎packages/vscode-typescript/src/client.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,8 @@ export class Client implements vscode.Disposable {
314314
logLevelListener,
315315
serverTelemetryListener,
316316
registerSourceDefinitionFeature(this.client),
317-
registerOnAutoInsertFeature(this.documentSelector, this.client),
318317
);
319-
// Register the selector-scoped custom providers (hover, multi-document highlight). These start
318+
// Register the selector-scoped custom providers (hover, multi-document highlight, on-auto-insert). These start
320319
// scoped to the static jsTs selector and expand as content-mapped extensions register.
321320
this.registerSelectorScopedFeatures();
322321
}
@@ -383,6 +382,7 @@ export class Client implements vscode.Disposable {
383382
this.selectorScopedFeatures.push(
384383
registerMultiDocumentHighlightFeature(selector, this.client),
385384
registerHoverFeature(selector, this.client),
385+
registerOnAutoInsertFeature(selector, this.client),
386386
);
387387
}
388388

‎packages/vscode-typescript/src/languageFeatures/util/dependentRegistration.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import * as vscode from "vscode";
33
export class Condition {
44
private _value: boolean;
55
private isDisposed = false;
6+
private readonly updateListener: vscode.Disposable;
67

78
constructor(
89
private readonly getValue: () => boolean,
9-
onUpdate: (handler: () => void) => void,
10+
onUpdate: (handler: () => void) => vscode.Disposable,
1011
) {
1112
this._value = this.getValue();
1213

13-
onUpdate(() => {
14+
this.updateListener = onUpdate(() => {
1415
const newValue = this.getValue();
1516
if (newValue !== this._value) {
1617
this._value = newValue;
@@ -31,6 +32,7 @@ export class Condition {
3132
return;
3233
}
3334
this.isDisposed = true;
35+
this.updateListener.dispose();
3436
this._onDidChange.dispose();
3537
}
3638
}

0 commit comments

Comments
 (0)