Instantiate ExperimentationService in typescript-language-features. (#160877)

Co-authored-by: Matt Bierner <matb@microsoft.com>
This commit is contained in:
Daniel Rosenwasser
2022-09-14 09:34:04 -07:00
committed by GitHub
parent fa1fee3b21
commit 00902daee1
2 changed files with 5 additions and 1 deletions

View File

@@ -23,7 +23,7 @@ export class ExperimentationService implements vscode.Disposable {
public async getTreatmentVariable<K extends keyof ExperimentTypes>(name: K, defaultValue: ExperimentTypes[K]): Promise<ExperimentTypes[K]> { public async getTreatmentVariable<K extends keyof ExperimentTypes>(name: K, defaultValue: ExperimentTypes[K]): Promise<ExperimentTypes[K]> {
const experimentationService = await this._experimentationServicePromise; const experimentationService = await this._experimentationServicePromise;
try { try {
const treatmentVariable = experimentationService.getTreatmentVariableAsync('vscode', name, /*checkCache*/ true) as ExperimentTypes[K]; const treatmentVariable = experimentationService.getTreatmentVariableAsync('vscode', name, /*checkCache*/ true) as Promise<ExperimentTypes[K]>;
return treatmentVariable; return treatmentVariable;
} catch { } catch {
return defaultValue; return defaultValue;

View File

@@ -8,6 +8,7 @@ import * as vscode from 'vscode';
import { Api, getExtensionApi } from './api'; import { Api, getExtensionApi } from './api';
import { CommandManager } from './commands/commandManager'; import { CommandManager } from './commands/commandManager';
import { registerBaseCommands } from './commands/index'; import { registerBaseCommands } from './commands/index';
import { ExperimentationService } from './experimentationService';
import { createLazyClientHost, lazilyActivateClient } from './lazyClientHost'; import { createLazyClientHost, lazilyActivateClient } from './lazyClientHost';
import { nodeRequestCancellerFactory } from './tsServer/cancellation.electron'; import { nodeRequestCancellerFactory } from './tsServer/cancellation.electron';
import { NodeLogDirectoryProvider } from './tsServer/logDirectoryProvider.electron'; import { NodeLogDirectoryProvider } from './tsServer/logDirectoryProvider.electron';
@@ -52,6 +53,9 @@ export function activate(
registerBaseCommands(commandManager, lazyClientHost, pluginManager, activeJsTsEditorTracker); registerBaseCommands(commandManager, lazyClientHost, pluginManager, activeJsTsEditorTracker);
// Currently no variables in use.
new ExperimentationService(context);
import('./task/taskProvider').then(module => { import('./task/taskProvider').then(module => {
context.subscriptions.push(module.register(lazyClientHost.map(x => x.serviceClient))); context.subscriptions.push(module.register(lazyClientHost.map(x => x.serviceClient)));
}); });