diff --git a/src/observers/OmnisharpLoggerObserver.ts b/src/observers/OmnisharpLoggerObserver.ts index 37ffdafc40..5a53f1268b 100644 --- a/src/observers/OmnisharpLoggerObserver.ts +++ b/src/observers/OmnisharpLoggerObserver.ts @@ -54,8 +54,8 @@ export class OmnisharpLoggerObserver extends BaseLoggerObserver { } private handleOmnisharpLaunch(event: OmnisharpLaunch) { - if (event.usingMono) { - this.logger.appendLine(`OmniSharp server started with Mono`); + if (event.monoVersion) { + this.logger.appendLine(`OmniSharp server started with Mono ${event.monoVersion}`); } else { this.logger.appendLine(`OmniSharp server started`); diff --git a/src/omnisharp/OmnisharpManager.ts b/src/omnisharp/OmnisharpManager.ts index aa843d44e6..5dbfedb153 100644 --- a/src/omnisharp/OmnisharpManager.ts +++ b/src/omnisharp/OmnisharpManager.ts @@ -9,60 +9,77 @@ import * as util from '../common'; import { OmnisharpDownloader } from './OmnisharpDownloader'; import { PlatformInformation } from '../platform'; +export interface LaunchInfo { + LaunchPath: string; + MonoLaunchPath?: string; +} + export class OmnisharpManager { public constructor( private downloader: OmnisharpDownloader, private platformInfo: PlatformInformation) { } - public async GetOmnisharpPath(omnisharpPath: string, useMono: boolean, serverUrl: string, latestVersionFileServerPath: string, installPath: string, extensionPath: string): Promise { + public async GetOmniSharpLaunchInfo(omnisharpPath: string, serverUrl: string, latestVersionFileServerPath: string, installPath: string, extensionPath: string): Promise { + if (!omnisharpPath) { + // If omnisharpPath was not specified, return the default path. + let basePath = path.resolve(extensionPath, '.omnisharp'); + return this.GetLaunchInfo(this.platformInfo, basePath); + } + // Looks at the options path, installs the dependencies and returns the path to be loaded by the omnisharp server if (path.isAbsolute(omnisharpPath)) { - if (await util.fileExists(omnisharpPath)) { - return omnisharpPath; - } - else { + if (!await util.fileExists(omnisharpPath)) { throw new Error('The system could not find the specified path'); } + + return { + LaunchPath: omnisharpPath + }; } - else if (omnisharpPath == "latest") { - return await this.InstallLatestAndReturnLaunchPath(useMono, serverUrl, latestVersionFileServerPath, installPath, extensionPath); + else if (omnisharpPath === 'latest') { + return await this.InstallLatestAndReturnLaunchInfo(serverUrl, latestVersionFileServerPath, installPath, extensionPath); } - //If the path is neither a valid path on disk not the string "latest", treat it as a version - return await this.InstallVersionAndReturnLaunchPath(omnisharpPath, useMono, serverUrl, installPath, extensionPath); + // If the path is neither a valid path on disk not the string "latest", treat it as a version + return await this.InstallVersionAndReturnLaunchInfo(omnisharpPath, serverUrl, installPath, extensionPath); } - private async InstallLatestAndReturnLaunchPath(useMono: boolean, serverUrl: string, latestVersionFileServerPath: string, installPath: string, extensionPath: string) { + private async InstallLatestAndReturnLaunchInfo(serverUrl: string, latestVersionFileServerPath: string, installPath: string, extensionPath: string): Promise { let version = await this.downloader.GetLatestVersion(serverUrl, latestVersionFileServerPath); - return await this.InstallVersionAndReturnLaunchPath(version, useMono, serverUrl, installPath, extensionPath); + return await this.InstallVersionAndReturnLaunchInfo(version, serverUrl, installPath, extensionPath); } - private async InstallVersionAndReturnLaunchPath(version: string, useMono: boolean, serverUrl: string, installPath: string, extensionPath: string) { + private async InstallVersionAndReturnLaunchInfo(version: string, serverUrl: string, installPath: string, extensionPath: string): Promise { if (semver.valid(version)) { await this.downloader.DownloadAndInstallOmnisharp(version, serverUrl, installPath); - return GetLaunchPathForVersion(this.platformInfo, version, installPath, extensionPath, useMono); + return this.GetLaunchPathForVersion(this.platformInfo, version, installPath, extensionPath); } else { - throw new Error(`Invalid omnisharp version - ${version}`); + throw new Error(`Invalid OmniSharp version - ${version}`); } } -} -function GetLaunchPathForVersion(platformInfo: PlatformInformation, version: string, installPath: string, extensionPath: string, useMono: boolean) { - if (!version) { - throw new Error('Invalid Version'); - } + private GetLaunchPathForVersion(platformInfo: PlatformInformation, version: string, installPath: string, extensionPath: string): LaunchInfo { + if (!version) { + throw new Error('Invalid Version'); + } - let basePath = path.resolve(extensionPath, installPath, version); + let basePath = path.resolve(extensionPath, installPath, version); - if (platformInfo.isWindows()) { - return path.join(basePath, 'OmniSharp.exe'); - } - if (useMono) { - return path.join(basePath, 'omnisharp', 'OmniSharp.exe'); + return this.GetLaunchInfo(platformInfo, basePath); } - return path.join(basePath, 'run'); -} + private GetLaunchInfo(platformInfo: PlatformInformation, basePath: string): LaunchInfo { + if (platformInfo.isWindows()) { + return { + LaunchPath: path.join(basePath, 'OmniSharp.exe') + }; + } + return { + LaunchPath: path.join(basePath, 'run'), + MonoLaunchPath: path.join(basePath, 'omnisharp', 'OmniSharp.exe') + }; + } +} \ No newline at end of file diff --git a/src/omnisharp/launcher.ts b/src/omnisharp/launcher.ts index bec8ffe515..84d76f5a38 100644 --- a/src/omnisharp/launcher.ts +++ b/src/omnisharp/launcher.ts @@ -8,8 +8,8 @@ import { satisfies } from 'semver'; import { PlatformInformation } from '../platform'; import * as path from 'path'; import * as vscode from 'vscode'; -import * as util from '../common'; import { Options } from './options'; +import { LaunchInfo } from './OmnisharpManager'; export enum LaunchTargetKind { Solution, @@ -201,12 +201,12 @@ function isCake(resource: vscode.Uri): boolean { export interface LaunchResult { process: ChildProcess; command: string; - usingMono: boolean; + monoVersion?: string; } -export async function launchOmniSharp(cwd: string, args: string[], launchPath: string): Promise { +export async function launchOmniSharp(cwd: string, args: string[], launchInfo: LaunchInfo): Promise { return new Promise((resolve, reject) => { - launch(cwd, args, launchPath) + launch(cwd, args, launchInfo) .then(result => { // async error - when target not not ENEOT result.process.on('error', err => { @@ -222,50 +222,42 @@ export async function launchOmniSharp(cwd: string, args: string[], launchPath: s }); } -async function launch(cwd: string, args: string[], launchPath: string): Promise { - return PlatformInformation.GetCurrent().then(platformInfo => { - const options = Options.Read(); - - if (options.useEditorFormattingSettings) { - let globalConfig = vscode.workspace.getConfiguration(); - let csharpConfig = vscode.workspace.getConfiguration('[csharp]'); +async function launch(cwd: string, args: string[], launchInfo: LaunchInfo): Promise { + const platformInfo = await PlatformInformation.GetCurrent(); + const options = Options.Read(); - args.push(`formattingOptions:useTabs=${!getConfigurationValue(globalConfig, csharpConfig, 'editor.insertSpaces', true)}`); - args.push(`formattingOptions:tabSize=${getConfigurationValue(globalConfig, csharpConfig, 'editor.tabSize', 4)}`); - args.push(`formattingOptions:indentationSize=${getConfigurationValue(globalConfig, csharpConfig, 'editor.tabSize', 4)}`); - } + if (options.useEditorFormattingSettings) { + let globalConfig = vscode.workspace.getConfiguration(); + let csharpConfig = vscode.workspace.getConfiguration('[csharp]'); - // If the user has provided an absolute path or the specified version has been installed successfully, we'll use the path. - if (launchPath) { - if (platformInfo.isWindows()) { - return launchWindows(launchPath, cwd, args); - } + args.push(`formattingOptions:useTabs=${!getConfigurationValue(globalConfig, csharpConfig, 'editor.insertSpaces', true)}`); + args.push(`formattingOptions:tabSize=${getConfigurationValue(globalConfig, csharpConfig, 'editor.tabSize', 4)}`); + args.push(`formattingOptions:indentationSize=${getConfigurationValue(globalConfig, csharpConfig, 'editor.tabSize', 4)}`); + } - // If we're launching on macOS/Linux, we have two possibilities: - // 1. Launch using Mono - // 2. Launch process directly (e.g. a 'run' script) - return options.useMono - ? launchNixMono(launchPath, cwd, args) - : launchNix(launchPath, cwd, args); - } + if (platformInfo.isWindows()) { + return launchWindows(launchInfo.LaunchPath, cwd, args); + } - // If the user has not provided a path, we'll use the locally-installed OmniSharp - const basePath = path.resolve(util.getExtensionPath(), '.omnisharp'); + let monoVersion = await getMonoVersion(); + let isValidMonoAvailable = await satisfies(monoVersion, '>=5.2.0'); - if (platformInfo.isWindows()) { - return launchWindows(path.join(basePath, 'OmniSharp.exe'), cwd, args); + // If the user specifically said that they wanted to launch on Mono, respect their wishes. + if (options.useMono) { + if (!isValidMonoAvailable) { + throw new Error('Cannot start OmniSharp because Mono version >=5.2.0 is required.'); } - // If it's possible to launch on a global Mono, we'll do that. Otherwise, run with our - // locally installed Mono runtime. - return canLaunchMono() - .then(async () => { - return launchNixMono(path.join(basePath, 'omnisharp', 'OmniSharp.exe'), cwd, args); - }) - .catch(_ => { - return launchNix(path.join(basePath, 'run'), cwd, args); - }); - }); + return launchNixMono(launchInfo.LaunchPath, monoVersion, cwd, args); + } + + // If we can launch on the global Mono, do so; otherwise, launch directly; + if (isValidMonoAvailable && launchInfo.MonoLaunchPath) { + return launchNixMono(launchInfo.MonoLaunchPath, monoVersion, cwd, args); + } + else { + return launchNix(launchInfo.LaunchPath, cwd, args); + } } function getConfigurationValue(globalConfig: vscode.WorkspaceConfiguration, csharpConfig: vscode.WorkspaceConfiguration, @@ -303,7 +295,6 @@ function launchWindows(launchPath: string, cwd: string, args: string[]): LaunchR return { process, command: launchPath, - usingMono: false }; } @@ -315,58 +306,41 @@ function launchNix(launchPath: string, cwd: string, args: string[]): LaunchResul return { process, - command: launchPath, - usingMono: true + command: launchPath }; } -async function launchNixMono(launchPath: string, cwd: string, args: string[]): Promise { - return canLaunchMono() - .then(() => { - let argsCopy = args.slice(0); // create copy of details args - argsCopy.unshift(launchPath); - argsCopy.unshift("--assembly-loader=strict"); - - let process = spawn('mono', argsCopy, { - detached: false, - cwd: cwd - }); - - return { - process, - command: launchPath, - usingMono: true - }; - }); -} +function launchNixMono(launchPath: string, monoVersion: string, cwd: string, args: string[]): LaunchResult { + let argsCopy = args.slice(0); // create copy of details args + argsCopy.unshift(launchPath); + argsCopy.unshift("--assembly-loader=strict"); -async function canLaunchMono(): Promise { - return new Promise((resolve, reject) => { - hasMono('>=5.2.0').then(success => { - if (success) { - resolve(); - } - else { - reject(new Error('Cannot start Omnisharp because Mono version >=5.2.0 is required.')); - } - }); + let process = spawn('mono', argsCopy, { + detached: false, + cwd: cwd }); + + return { + process, + command: launchPath, + monoVersion, + }; } -export async function hasMono(range?: string): Promise { +async function getMonoVersion(): Promise { const versionRegexp = /(\d+\.\d+\.\d+)/; - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { let childprocess: ChildProcess; try { childprocess = spawn('mono', ['--version']); } catch (e) { - return resolve(false); + return resolve(undefined); } childprocess.on('error', function (err: any) { - resolve(false); + resolve(undefined); }); let stdout = ''; @@ -375,20 +349,14 @@ export async function hasMono(range?: string): Promise { }); childprocess.stdout.on('close', () => { - let match = versionRegexp.exec(stdout), - ret: boolean; + let match = versionRegexp.exec(stdout); - if (!match) { - ret = false; - } - else if (!range) { - ret = true; + if (match && match.length > 1) { + resolve(match[1]); } else { - ret = satisfies(match[1], range); + resolve(undefined); } - - resolve(ret); }); }); } \ No newline at end of file diff --git a/src/omnisharp/loggingEvents.ts b/src/omnisharp/loggingEvents.ts index 5eda58ff41..0a7f70fa67 100644 --- a/src/omnisharp/loggingEvents.ts +++ b/src/omnisharp/loggingEvents.ts @@ -27,7 +27,7 @@ export class OmnisharpInitialisation implements BaseEvent { } export class OmnisharpLaunch implements BaseEvent { - constructor(public usingMono: boolean, public command: string, public pid: number) { } + constructor(public monoVersion: string, public command: string, public pid: number) { } } export class PackageInstallation implements BaseEvent { diff --git a/src/omnisharp/server.ts b/src/omnisharp/server.ts index d5431123fb..510bf5904e 100644 --- a/src/omnisharp/server.ts +++ b/src/omnisharp/server.ts @@ -15,7 +15,7 @@ import { ReadLine, createInterface } from 'readline'; import { Request, RequestQueueCollection } from './requestQueue'; import { DelayTracker } from './delayTracker'; import { EventEmitter } from 'events'; -import { OmnisharpManager } from './OmnisharpManager'; +import { OmnisharpManager, LaunchInfo } from './OmnisharpManager'; import { Options } from './options'; import { PlatformInformation } from '../platform'; import { launchOmniSharp } from './launcher'; @@ -312,39 +312,37 @@ export class OmniSharpServer { args.push('--debug'); } - let launchPath: string; - if (this._options.path) { - try { - let extensionPath = utils.getExtensionPath(); - launchPath = await this._omnisharpManager.GetOmnisharpPath(this._options.path, this._options.useMono, serverUrl, latestVersionFileServerPath, installPath, extensionPath); - } - catch (error) { - this.eventStream.post(new ObservableEvents.OmnisharpFailure(`Error occured in loading omnisharp from omnisharp.path\nCould not start the server due to ${error.toString()}`, error)); - return; - } + let launchInfo: LaunchInfo; + try { + let extensionPath = utils.getExtensionPath(); + launchInfo = await this._omnisharpManager.GetOmniSharpLaunchInfo(this._options.path, serverUrl, latestVersionFileServerPath, installPath, extensionPath); + } + catch (error) { + this.eventStream.post(new ObservableEvents.OmnisharpFailure(`Error occured in loading omnisharp from omnisharp.path\nCould not start the server due to ${error.toString()}`, error)); + return; } this.eventStream.post(new ObservableEvents.OmnisharpInitialisation(new Date(), solutionPath)); this._fireEvent(Events.BeforeServerStart, solutionPath); - return launchOmniSharp(cwd, args, launchPath).then(async value => { - this.eventStream.post(new ObservableEvents.OmnisharpLaunch(value.usingMono, value.command, value.process.pid)); + try { + let launchResult = await launchOmniSharp(cwd, args, launchInfo); + this.eventStream.post(new ObservableEvents.OmnisharpLaunch(launchResult.monoVersion, launchResult.command, launchResult.process.pid)); - this._serverProcess = value.process; + this._serverProcess = launchResult.process; this._delayTrackers = {}; this._setState(ServerState.Started); this._fireEvent(Events.ServerStart, solutionPath); - return this._doConnect(); - }).then(() => { - // Start telemetry reporting + await this._doConnect(); + this._telemetryIntervalId = setInterval(() => this._reportTelemetry(), TelemetryReportingDelay); - }).then(() => { this._requestQueue.drain(); - }).catch(async err => { + } + catch (err) { this._fireEvent(Events.ServerError, err); return this.stop(); - }); + } } private debounceUpdateProjectWithLeadingTrue = () => { diff --git a/test/featureTests/OmnisharpManager.test.ts b/test/featureTests/OmnisharpManager.test.ts index 55d45ebabb..edbe7ae757 100644 --- a/test/featureTests/OmnisharpManager.test.ts +++ b/test/featureTests/OmnisharpManager.test.ts @@ -5,7 +5,7 @@ import * as path from 'path'; import * as util from '../../src/common'; -import { should } from "chai"; +import { expect, should } from "chai"; import { PlatformInformation } from "../../src/platform"; import { rimraf } from 'async-file'; import { OmnisharpManager } from '../../src/omnisharp/OmnisharpManager'; @@ -14,7 +14,6 @@ import { GetTestOmnisharpDownloader } from './testAssets/testAssets'; const chai = require("chai"); chai.use(require("chai-as-promised")); -let expect = chai.expect; const tmp = require('tmp'); @@ -23,7 +22,6 @@ suite('GetExperimentalOmnisharpPath : Returns Omnisharp experiment path dependin const serverUrl = "https://roslynomnisharp.blob.core.windows.net"; const installPath = ".omnisharp/experimental"; const versionFilepathInServer = "releases/testVersionInfo.txt"; - const useMono = false; const eventStream = new EventStream(); const manager = GetTestOmnisharpManager(eventStream, platformInfo); let extensionPath: string; @@ -39,59 +37,70 @@ suite('GetExperimentalOmnisharpPath : Returns Omnisharp experiment path dependin }); test('Throws error if the path is neither an absolute path nor a valid semver, nor the string "latest"', async () => { - expect(manager.GetOmnisharpPath("Some incorrect path", useMono, serverUrl, versionFilepathInServer, installPath, extensionPath)).to.be.rejectedWith(Error); + expect(manager.GetOmniSharpLaunchInfo("Some incorrect path", serverUrl, versionFilepathInServer, installPath, extensionPath)).to.be.rejectedWith(Error); }); test('Throws error when the specified path is null', async () => { - expect(manager.GetOmnisharpPath(null, useMono, serverUrl, versionFilepathInServer, installPath, extensionPath)).to.be.rejectedWith(Error); + expect(manager.GetOmniSharpLaunchInfo(null, serverUrl, versionFilepathInServer, installPath, extensionPath)).to.be.rejectedWith(Error); }); test('Throws error when the specified path is empty', async () => { - expect(manager.GetOmnisharpPath("", useMono, serverUrl, versionFilepathInServer, installPath, extensionPath)).to.be.rejectedWith(Error); + expect(manager.GetOmniSharpLaunchInfo("", serverUrl, versionFilepathInServer, installPath, extensionPath)).to.be.rejectedWith(Error); }); test('Throws error when the specified path is an invalid semver', async () => { - expect(manager.GetOmnisharpPath("a.b.c", useMono, serverUrl, versionFilepathInServer, installPath, extensionPath)).to.be.rejectedWith(Error); + expect(manager.GetOmniSharpLaunchInfo("a.b.c", serverUrl, versionFilepathInServer, installPath, extensionPath)).to.be.rejectedWith(Error); + }); + + test('Returns default paths if no path is specified', async () => { + let launchInfo = await manager.GetOmniSharpLaunchInfo(undefined, serverUrl, versionFilepathInServer, installPath, extensionPath); + launchInfo.LaunchPath.should.equal(path.resolve(extensionPath, '.omnisharp/OmniSharp.exe')); + expect(launchInfo.MonoLaunchPath).to.be.undefined; + }); + + test('Returns default paths if no path is specified - Linux ', async () => { + let manager = GetTestOmnisharpManager(eventStream, new PlatformInformation("linux", "x64")); + let launchInfo = await manager.GetOmniSharpLaunchInfo(undefined, serverUrl, versionFilepathInServer, installPath, extensionPath); + launchInfo.LaunchPath.should.equal(path.resolve(extensionPath, '.omnisharp/run')); + launchInfo.MonoLaunchPath.should.equal(path.resolve(extensionPath, '.omnisharp/omnisharp/OmniSharp.exe')); }); test('Returns the same path if absolute path to an existing file is passed', async () => { tmpFile = tmp.fileSync(); - let omnisharpPath = await manager.GetOmnisharpPath(tmpFile.name, useMono, serverUrl, versionFilepathInServer, installPath, extensionPath); - omnisharpPath.should.equal(tmpFile.name); + let launchInfo = await manager.GetOmniSharpLaunchInfo(tmpFile.name, serverUrl, versionFilepathInServer, installPath, extensionPath); + launchInfo.LaunchPath.should.equal(tmpFile.name); }); test('Installs the latest version and returns the launch path based on the version and platform', async () => { - let omnisharpPath = await manager.GetOmnisharpPath("latest", useMono, serverUrl, versionFilepathInServer, installPath, extensionPath); - omnisharpPath.should.equal(path.resolve(extensionPath, `.omnisharp/experimental/1.2.3/OmniSharp.exe`)); + let launchInfo = await manager.GetOmniSharpLaunchInfo("latest", serverUrl, versionFilepathInServer, installPath, extensionPath); + launchInfo.LaunchPath.should.equal(path.resolve(extensionPath, `.omnisharp/experimental/1.2.3/OmniSharp.exe`)); + expect(launchInfo.MonoLaunchPath).to.be.undefined; }); test('Installs the test version and returns the launch path based on the version and platform', async () => { - let omnisharpPath = await manager.GetOmnisharpPath("1.2.3", useMono, serverUrl, versionFilepathInServer, installPath, extensionPath); - omnisharpPath.should.equal(path.resolve(extensionPath, `.omnisharp/experimental/1.2.3/OmniSharp.exe`)); + let launchInfo = await manager.GetOmniSharpLaunchInfo("1.2.3", serverUrl, versionFilepathInServer, installPath, extensionPath); + launchInfo.LaunchPath.should.equal(path.resolve(extensionPath, `.omnisharp/experimental/1.2.3/OmniSharp.exe`)); + expect(launchInfo.MonoLaunchPath).to.be.undefined; }); test('Downloads package from given url and installs them at the specified path', async () => { - await manager.GetOmnisharpPath("1.2.3", useMono, serverUrl, versionFilepathInServer, installPath, extensionPath); + await manager.GetOmniSharpLaunchInfo("1.2.3", serverUrl, versionFilepathInServer, installPath, extensionPath); let exists = await util.fileExists(path.resolve(extensionPath, `.omnisharp/experimental/1.2.3/install_check_1.2.3.txt`)); exists.should.equal(true); }); - test('Downloads package and returns launch path based on platform - Not using mono on Linux ', async () => { - let manager = GetTestOmnisharpManager(eventStream, new PlatformInformation("linux", "x64")); - let launchPath = await manager.GetOmnisharpPath("1.2.3", useMono, serverUrl, versionFilepathInServer, installPath, extensionPath); - launchPath.should.equal(path.resolve(extensionPath, '.omnisharp/experimental/1.2.3/run')); - }); - - test('Downloads package and returns launch path based on platform - Using mono on Linux ', async () => { + test('Downloads package and returns launch path based on platform - on Linux ', async () => { let manager = GetTestOmnisharpManager(eventStream, new PlatformInformation("linux", "x64")); - let launchPath = await manager.GetOmnisharpPath("1.2.3", true, serverUrl, versionFilepathInServer, installPath, extensionPath); - launchPath.should.equal(path.resolve(extensionPath, '.omnisharp/experimental/1.2.3/omnisharp/OmniSharp.exe')); + let launchInfo = await manager.GetOmniSharpLaunchInfo("1.2.3", serverUrl, versionFilepathInServer, installPath, extensionPath); + launchInfo.LaunchPath.should.equal(path.resolve(extensionPath, '.omnisharp/experimental/1.2.3/run')); + launchInfo.MonoLaunchPath.should.equal(path.resolve(extensionPath, '.omnisharp/experimental/1.2.3/omnisharp/OmniSharp.exe')); }); test('Downloads package and returns launch path based on install path ', async () => { let manager = GetTestOmnisharpManager(eventStream, platformInfo); - let launchPath = await manager.GetOmnisharpPath("1.2.3", true, serverUrl, versionFilepathInServer, "installHere", extensionPath); - launchPath.should.equal(path.resolve(extensionPath, 'installHere/1.2.3/OmniSharp.exe')); + let launchInfo = await manager.GetOmniSharpLaunchInfo("1.2.3", serverUrl, versionFilepathInServer, "installHere", extensionPath); + launchInfo.LaunchPath.should.equal(path.resolve(extensionPath, 'installHere/1.2.3/OmniSharp.exe')); + expect(launchInfo.MonoLaunchPath).to.be.undefined; }); teardown(async () => { diff --git a/test/unitTests/logging/OmnisharpLoggerObserver.test.ts b/test/unitTests/logging/OmnisharpLoggerObserver.test.ts index e8e63a72ac..25a6012684 100644 --- a/test/unitTests/logging/OmnisharpLoggerObserver.test.ts +++ b/test/unitTests/logging/OmnisharpLoggerObserver.test.ts @@ -135,8 +135,8 @@ suite("OmnisharpLoggerObserver", () => { suite('OmnisharpLaunch', () => { [ - new OmnisharpLaunch(true, "someCommand", 4), - new OmnisharpLaunch(false, "someCommand", 4) + new OmnisharpLaunch("5.8.0", "someCommand", 4), + new OmnisharpLaunch(undefined, "someCommand", 4) ].forEach((event: OmnisharpLaunch) => { test(`Command and Pid are displayed`, () => { @@ -147,8 +147,8 @@ suite("OmnisharpLoggerObserver", () => { test(`Message is displayed depending on usingMono value`, () => { observer.post(event); - if (event.usingMono) { - expect(logOutput).to.contain("OmniSharp server started with Mono"); + if (event.monoVersion) { + expect(logOutput).to.contain("OmniSharp server started with Mono 5.8.0"); } else { expect(logOutput).to.contain("OmniSharp server started");