Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run OmniSharp on an embedded Mono runtime and add support for MSBuild-based .NET Core projects #886

Merged
merged 4 commits into from
Nov 11, 2016
Merged
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
155 changes: 50 additions & 105 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,139 +53,84 @@
},
"runtimeDependencies": [
{
"description": "OmniSharp (Windows / x86)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-win-x86-net46.zip",
"installPath": ".omnisharp-desktop",
"runtimeIds": [
"win7-x86"
]
},
{
"description": "OmniSharp (Windows / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-win-x64-net46.zip",
"installPath": ".omnisharp-desktop",
"runtimeIds": [
"win7-x64"
]
},
{
"description": "OmniSharp (.NET Core - Windows / x86)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-win-x86-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"win7-x86"
],
"binaries": [
"./OmniSharp"
]
},
{
"description": "OmniSharp (.NET Core - Windows / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-win-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"win7-x64"
],
"binaries": [
"./OmniSharp"
]
},
{
"description": "OmniSharp (.NET Core - macOS / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-osx-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"osx.10.11-x64"
"description": "Mono Runtime (Linux / x86)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/mono.linux-x86-4.6.1.zip",
"installPath": "./bin",
"platforms": [
"linux"
],
"binaries": [
"./OmniSharp"
]
},
{
"description": "OmniSharp (.NET Core - CentOS / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-centos-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"centos.7-x64"
"architectures": [
"x86"
],
"binaries": [
"./OmniSharp"
"./mono.linux-x86",
"./run"
]
},
{
"description": "OmniSharp (.NET Core - Debian / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-debian-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"debian.8-x64"
"description": "Mono Runtime (Linux / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/mono.linux-x86_64-4.6.1.zip",
"installPath": "./bin",
"platforms": [
"linux"
],
"binaries": [
"./OmniSharp"
]
},
{
"description": "OmniSharp (.NET Core - Fedora / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-fedora-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"fedora.23-x64"
"architectures": [
"x86_64"
],
"binaries": [
"./OmniSharp"
"./mono.linux-x86_64",
"./run"
]
},
{
"description": "OmniSharp (.NET Core - OpenSUSE / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-opensuse-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"opensuse.13.2-x64"
"description": "Mono Runtime (macOS)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/mono.osx-4.6.1.zip",
"installPath": "./bin",
"platforms": [
"darwin"
],
"binaries": [
"./OmniSharp"
"./mono.osx",
"./run"
]
},
{
"description": "OmniSharp (.NET Core - RHEL / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-rhel-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"rhel.7-x64"
],
"binaries": [
"./.OmniSharp"
"description": "Mono Framework Assemblies",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/framework-4.6.1.zip",
"installPath": "./bin/framework",
"platforms": [
"darwin",
"linux"
]
},
{
"description": "OmniSharp (.NET Core - Ubuntu 14 / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-ubuntu14-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"ubuntu.14.04-x64"
"description": "OmniSharp (.NET 4.6 / x86)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x86-1.9-beta19.zip",
"installPath": "./bin/omnisharp",
"platforms": [
"win32"
],
"binaries": [
"./OmniSharp"
"architectures": [
"x86",
"32-bit"
]
},
{
"description": "OmniSharp (.NET Core - Ubuntu 16 / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-ubuntu16-x64-netcoreapp1.0.zip",
"installPath": ".omnisharp-coreclr",
"runtimeIds": [
"ubuntu.16.04-x64"
"description": "OmniSharp (.NET 4.6 / x64)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x64-1.9-beta19.zip",
"installPath": "./bin/omnisharp",
"platforms": [
"win32"
],
"binaries": [
"./OmniSharp"
"architectures": [
"x86_64",
"64-bit"
]
},
{
"description": "OmniSharp (Mono)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-mono.zip",
"installPath": ".omnisharp-mono",
"architectures": [
"x86",
"x86_64"
],
"description": "OmniSharp (Mono 4.6)",
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-mono-1.9-beta19.zip",
"installPath": "./bin/omnisharp",
"platforms": [
"darwin",
"linux"
Expand Down
35 changes: 10 additions & 25 deletions src/omnisharp/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ export interface LaunchResult {
usingMono: boolean;
}

export function launchOmniSharp(cwd: string, args: string[], kind: LaunchTargetKind): Promise<LaunchResult> {
export function launchOmniSharp(cwd: string, args: string[]): Promise<LaunchResult> {
return new Promise<LaunchResult>((resolve, reject) => {
launch(cwd, args, kind)
launch(cwd, args)
.then(result => {
// async error - when target not not ENEOT
result.process.on('error', err => {
Expand All @@ -155,46 +155,31 @@ export function launchOmniSharp(cwd: string, args: string[], kind: LaunchTargetK
});
}

function launch(cwd: string, args: string[], kind: LaunchTargetKind): Promise<LaunchResult> {
function launch(cwd: string, args: string[]): Promise<LaunchResult> {
return PlatformInformation.GetCurrent().then(platformInfo => {
const options = Options.Read();

if (options.path && options.useMono) {
return launchNixMono(options.path, cwd, args);
}

const launchPath = options.path || getLaunchPath(platformInfo, kind);
const launchPath = options.path || getLaunchPath(platformInfo);

if (platformInfo.isWindows()) {
return launchWindows(launchPath, cwd, args);
}
else {
if (kind === LaunchTargetKind.Solution) {
return launchNixMono(launchPath, cwd, args);
}
else {
return launchNix(launchPath, cwd, args);
}
return launchNix(launchPath, cwd, args);
}
});
}

function getLaunchPath(platformInfo: PlatformInformation, kind: LaunchTargetKind): string {
if (kind === LaunchTargetKind.Solution) {
if (platformInfo.isWindows()) {
return path.join(util.getExtensionPath(), '.omnisharp-desktop', 'OmniSharp.exe');
}
function getLaunchPath(platformInfo: PlatformInformation): string {
const binPath = util.getBinPath();

return path.join(util.getExtensionPath(), '.omnisharp-mono', 'OmniSharp.exe');
}

let basePath = path.join(util.getExtensionPath(), '.omnisharp-coreclr');
if (platformInfo.isWindows()) {
return path.join(basePath, 'OmniSharp.exe');
}
else {
return path.join(basePath, 'OmniSharp');
}
return platformInfo.isWindows()
? path.join(binPath, 'omnisharp', 'OmniSharp.exe')
: path.join(binPath, 'run');
}

function launchWindows(launchPath: string, cwd: string, args: string[]): LaunchResult {
Expand Down
2 changes: 1 addition & 1 deletion src/omnisharp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export abstract class OmnisharpServer {

this._fireEvent(Events.BeforeServerStart, solutionPath);

return launchOmniSharp(cwd, args, launchTarget.kind).then(value => {
return launchOmniSharp(cwd, args).then(value => {
if (value.usingMono) {
this._logger.appendLine(`OmniSharp server started wth Mono`);
}
Expand Down