(
context: vscode.ExtensionContext
)
| 32 | import { LimitedActivationStatus } from './shared/limitedActivationStatus'; |
| 33 | |
| 34 | export async function activate( |
| 35 | context: vscode.ExtensionContext |
| 36 | ): Promise<CSharpExtensionExports | OmnisharpExtensionExports | LimitedExtensionExports | null> { |
| 37 | // Start measuring the activation time |
| 38 | const startActivation = process.hrtime(); |
| 39 | |
| 40 | const csharpChannel = vscode.window.createOutputChannel('C#', { log: true }); |
| 41 | csharpChannel.trace('Activating C# Extension'); |
| 42 | |
| 43 | util.setExtensionPath(context.extension.extensionPath); |
| 44 | |
| 45 | const aiKey = context.extension.packageJSON.contributes.debuggers[0].aiKey; |
| 46 | const reporter = new TelemetryReporter(aiKey); |
| 47 | // ensure it gets properly disposed. Upon disposal the events will be flushed. |
| 48 | context.subscriptions.push(reporter); |
| 49 | |
| 50 | const eventStream = new EventStream(); |
| 51 | const csharpchannelObserver = new CsharpChannelObserver(csharpChannel); |
| 52 | const csharpLogObserver = new CsharpLoggerObserver(csharpChannel); |
| 53 | eventStream.subscribe(csharpchannelObserver.post); |
| 54 | eventStream.subscribe(csharpLogObserver.post); |
| 55 | |
| 56 | let platformInfo: PlatformInformation; |
| 57 | try { |
| 58 | platformInfo = await PlatformInformation.GetCurrent(); |
| 59 | } catch (error) { |
| 60 | eventStream.post(new ActivationFailure()); |
| 61 | throw error; |
| 62 | } |
| 63 | |
| 64 | // Verify that the current platform is supported by the extension and inform the user if not. |
| 65 | if (!checkIsSupportedPlatform(context, platformInfo)) { |
| 66 | return null; |
| 67 | } |
| 68 | |
| 69 | await checkDotNetRuntimeExtensionVersion(context); |
| 70 | |
| 71 | await MigrateOptions(vscode); |
| 72 | const optionStream = createOptionStream(vscode); |
| 73 | |
| 74 | const requiredPackageIds: string[] = ['Debugger', 'Razor']; |
| 75 | |
| 76 | const csharpDevkitExtension = getCSharpDevKit(); |
| 77 | const useOmnisharpServer = !csharpDevkitExtension && commonOptions.useOmnisharpServer; |
| 78 | if (useOmnisharpServer) { |
| 79 | requiredPackageIds.push('OmniSharp'); |
| 80 | } |
| 81 | requiredPackageIds.push('VSWebAssemblyBridge'); |
| 82 | if (csharpDevkitExtension) { |
| 83 | requiredPackageIds.push('RoslynCopilot'); |
| 84 | } |
| 85 | |
| 86 | const networkSettingsProvider = vscodeNetworkSettingsProvider(vscode); |
| 87 | const useFramework = useOmnisharpServer && omnisharpOptions.useModernNet !== true; |
| 88 | const installDependencies: IInstallDependencies = async (dependencies: AbsolutePathPackage[]) => |
| 89 | downloadAndInstallPackages(dependencies, networkSettingsProvider, eventStream, isValidDownload, reporter); |
| 90 | |
| 91 | const runtimeDependenciesExist = await installRuntimeDependencies( |
nothing calls this directly
no test coverage detected