Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import { readUnifiedConfig, unifiedConfigSection } from '../utils/configuration'
import { Command } from './commandManager';

export const tsNativeExtensionOldId = 'typescriptteam.native-preview';
export const tsNativeExtensionIds = ['typescriptteam.vscode-typescript', tsNativeExtensionOldId] as const;
export const tsNativeExtensionIds = [
'typescriptteam.vscode-typescript',
'typescriptteam.vscode-typescript-nightly',
tsNativeExtensionOldId
] as const;

export function getTsNativeExtension(): vscode.Extension<unknown> | undefined {
for (const extensionId of tsNativeExtensionIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as tas from 'vscode-tas-client';
import { IExperimentationTelemetryReporter } from './experimentTelemetryReporter';

interface ExperimentTypes {
suggestNativePreview: boolean;
suggestTS7IfNoPlugins: boolean;
}

export class ExperimentationService {
Expand Down
2 changes: 1 addition & 1 deletion extensions/typescript-language-features/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function activate(
context.subscriptions.push(experimentTelemetryReporter);

const experimentationService = new ExperimentationService(experimentTelemetryReporter, id, version, context.globalState);
suggestNativePreview(context, experimentationService);
suggestNativePreview(context, experimentationService, pluginManager);
}

// Register features that work in both TSGO and non-TSGO modes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const emptyAuthority = 'ts-nul-authority';

export const inMemoryResourcePrefix = '^';

const copilotChatExtensionId = 'github.copilot-chat';
export const copilotChatExtensionId = 'github.copilot-chat';

interface WatchEvent {
updated?: Set<string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
import * as vscode from 'vscode';
import { getTsNativeExtension, tsNativeExtensionOldId } from '../commands/useTsgo';
import { ExperimentationService } from '../experimentationService';
import { PluginManager } from '../tsServer/plugins';
import { copilotChatExtensionId } from '../typescriptServiceClient';

const suggestNativePreviewStorageKey = 'typescript.suggestNativePreview.dismissed';

export async function suggestNativePreview(
context: vscode.ExtensionContext,
experimentationService: ExperimentationService,
pluginManager: PluginManager,
): Promise<void> {
if (context.globalState.get<boolean>(suggestNativePreviewStorageKey)) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We're specifically using the same storage key so that if you got this prompt in the past, we won't bug you again.

But I'm now thinking that maybe we should respect the key and not show anything, but set a separate one for new users instead.

return;
Expand All @@ -22,8 +25,8 @@ export async function suggestNativePreview(
return;
}

// Only show when the nightly extension is installed
if (!vscode.extensions.getExtension('ms-vscode.vscode-typescript-next')) {
// TSServer plugins are not supported by TypeScript 7
if (pluginManager.plugins.some(plugin => plugin.extension.id.toLowerCase() !== copilotChatExtensionId)) {
return;
}

Expand All @@ -34,7 +37,7 @@ export async function suggestNativePreview(
return;
}

const inExperiment = await experimentationService.getTreatmentVariable('suggestNativePreview', false);
const inExperiment = await experimentationService.getTreatmentVariable('suggestTS7IfNoPlugins', false);
if (!inExperiment) {
return;
}
Expand Down