Skip to content

Add one time prompt to try ts 7.0 if you have ts nightly installed#311977

Merged
mjbvz merged 1 commit intomicrosoft:mainfrom
mjbvz:dev/mjbvz/selected-barracuda
Apr 22, 2026
Merged

Add one time prompt to try ts 7.0 if you have ts nightly installed#311977
mjbvz merged 1 commit intomicrosoft:mainfrom
mjbvz:dev/mjbvz/selected-barracuda

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented Apr 22, 2026

Fixes #311966

Copilot AI review requested due to automatic review settings April 22, 2026 19:32
@mjbvz mjbvz enabled auto-merge April 22, 2026 19:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a one-time, experiment-gated notification in the TypeScript language features extension that prompts TypeScript Nightly users to try the “TypeScript 7 Native Preview” extension.

Changes:

  • Introduces suggestNativePreview UI flow that detects TS Nightly, checks experiment enrollment, and offers Install / Learn More / Don’t Show Again.
  • Wires the prompt into extension activation after creating the experimentation service.
  • Extends experimentation typings and adjusts treatment variable retrieval to fall back to the provided default when the variable is unset.
Show a summary per file
File Description
extensions/typescript-language-features/src/ui/suggestNativePreview.ts New one-time prompt logic gated by TS Nightly presence and an experimentation treatment variable.
extensions/typescript-language-features/src/extension.ts Instantiates the experimentation service and triggers the prompt during activation.
extensions/typescript-language-features/src/experimentationService.ts Adds the new experiment variable type and refines treatment variable retrieval/defaulting.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

try {
const treatmentVariable = experimentationService.getTreatmentVariableAsync('vscode', name, /*checkCache*/ true) as Promise<ExperimentTypes[K]>;
return treatmentVariable;
const treatmentVariable = await experimentationService.getTreatmentVariableAsync('vscode', name, /*checkCache*/ true) as ExperimentTypes[K];
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await experimentationService.getTreatmentVariableAsync(...) as ExperimentTypes[K] relies on await/type-assertion precedence and is easy to misread as asserting the Promise rather than the resolved value. Consider restructuring to await first and then apply the type assertion (or otherwise avoid the combined await ... as ... form) to keep the typing accurate and the intent clear.

Suggested change
const treatmentVariable = await experimentationService.getTreatmentVariableAsync('vscode', name, /*checkCache*/ true) as ExperimentTypes[K];
const rawTreatmentVariable = await experimentationService.getTreatmentVariableAsync('vscode', name, /*checkCache*/ true);
const treatmentVariable = rawTreatmentVariable as ExperimentTypes[K];

Copilot uses AI. Check for mistakes.
// shared properties to the ExperimentationTelemetryReporter we just created.
new ExperimentationService(experimentTelemetryReporter, id, version, context.globalState);
const experimentationService = new ExperimentationService(experimentTelemetryReporter, id, version, context.globalState);
suggestNativePreview(context, experimentationService);
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to suggestNativePreview returns a Promise but is neither awaited nor explicitly handled. This can lead to unhandled promise rejections during activation if the prompt/command throws. Consider either awaiting it (if activation should wait) or prefixing with void and adding internal error handling inside suggestNativePreview (e.g. a top-level try/catch) to ensure failures don’t surface as unhandled rejections.

Suggested change
suggestNativePreview(context, experimentationService);
void suggestNativePreview(context, experimentationService).catch(() => {
// Ignore errors from this non-blocking suggestion flow during activation.
});

Copilot uses AI. Check for mistakes.
@mjbvz mjbvz merged commit 7ba951a into microsoft:main Apr 22, 2026
30 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompt TS nightly extension users to try TS 7.0

3 participants