Skip to content

Commit 12714e5

Browse files
Merge pull request #886 from DustinCampbell/mono-work
Run OmniSharp on an embedded Mono runtime and add support for MSBuild-based .NET Core projects
2 parents 8f281ba + 98ef979 commit 12714e5

File tree

3 files changed

+61
-131
lines changed

3 files changed

+61
-131
lines changed

package.json

Lines changed: 50 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -53,139 +53,84 @@
5353
},
5454
"runtimeDependencies": [
5555
{
56-
"description": "OmniSharp (Windows / x86)",
57-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-win-x86-net46.zip",
58-
"installPath": ".omnisharp-desktop",
59-
"runtimeIds": [
60-
"win7-x86"
61-
]
62-
},
63-
{
64-
"description": "OmniSharp (Windows / x64)",
65-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-win-x64-net46.zip",
66-
"installPath": ".omnisharp-desktop",
67-
"runtimeIds": [
68-
"win7-x64"
69-
]
70-
},
71-
{
72-
"description": "OmniSharp (.NET Core - Windows / x86)",
73-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-win-x86-netcoreapp1.0.zip",
74-
"installPath": ".omnisharp-coreclr",
75-
"runtimeIds": [
76-
"win7-x86"
77-
],
78-
"binaries": [
79-
"./OmniSharp"
80-
]
81-
},
82-
{
83-
"description": "OmniSharp (.NET Core - Windows / x64)",
84-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-win-x64-netcoreapp1.0.zip",
85-
"installPath": ".omnisharp-coreclr",
86-
"runtimeIds": [
87-
"win7-x64"
88-
],
89-
"binaries": [
90-
"./OmniSharp"
91-
]
92-
},
93-
{
94-
"description": "OmniSharp (.NET Core - macOS / x64)",
95-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-osx-x64-netcoreapp1.0.zip",
96-
"installPath": ".omnisharp-coreclr",
97-
"runtimeIds": [
98-
"osx.10.11-x64"
56+
"description": "Mono Runtime (Linux / x86)",
57+
"url": "https://omnisharpdownload.blob.core.windows.net/ext/mono.linux-x86-4.6.1.zip",
58+
"installPath": "./bin",
59+
"platforms": [
60+
"linux"
9961
],
100-
"binaries": [
101-
"./OmniSharp"
102-
]
103-
},
104-
{
105-
"description": "OmniSharp (.NET Core - CentOS / x64)",
106-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-centos-x64-netcoreapp1.0.zip",
107-
"installPath": ".omnisharp-coreclr",
108-
"runtimeIds": [
109-
"centos.7-x64"
62+
"architectures": [
63+
"x86"
11064
],
11165
"binaries": [
112-
"./OmniSharp"
66+
"./mono.linux-x86",
67+
"./run"
11368
]
11469
},
11570
{
116-
"description": "OmniSharp (.NET Core - Debian / x64)",
117-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-debian-x64-netcoreapp1.0.zip",
118-
"installPath": ".omnisharp-coreclr",
119-
"runtimeIds": [
120-
"debian.8-x64"
71+
"description": "Mono Runtime (Linux / x64)",
72+
"url": "https://omnisharpdownload.blob.core.windows.net/ext/mono.linux-x86_64-4.6.1.zip",
73+
"installPath": "./bin",
74+
"platforms": [
75+
"linux"
12176
],
122-
"binaries": [
123-
"./OmniSharp"
124-
]
125-
},
126-
{
127-
"description": "OmniSharp (.NET Core - Fedora / x64)",
128-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-fedora-x64-netcoreapp1.0.zip",
129-
"installPath": ".omnisharp-coreclr",
130-
"runtimeIds": [
131-
"fedora.23-x64"
77+
"architectures": [
78+
"x86_64"
13279
],
13380
"binaries": [
134-
"./OmniSharp"
81+
"./mono.linux-x86_64",
82+
"./run"
13583
]
13684
},
13785
{
138-
"description": "OmniSharp (.NET Core - OpenSUSE / x64)",
139-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-opensuse-x64-netcoreapp1.0.zip",
140-
"installPath": ".omnisharp-coreclr",
141-
"runtimeIds": [
142-
"opensuse.13.2-x64"
86+
"description": "Mono Runtime (macOS)",
87+
"url": "https://omnisharpdownload.blob.core.windows.net/ext/mono.osx-4.6.1.zip",
88+
"installPath": "./bin",
89+
"platforms": [
90+
"darwin"
14391
],
14492
"binaries": [
145-
"./OmniSharp"
93+
"./mono.osx",
94+
"./run"
14695
]
14796
},
14897
{
149-
"description": "OmniSharp (.NET Core - RHEL / x64)",
150-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-rhel-x64-netcoreapp1.0.zip",
151-
"installPath": ".omnisharp-coreclr",
152-
"runtimeIds": [
153-
"rhel.7-x64"
154-
],
155-
"binaries": [
156-
"./.OmniSharp"
98+
"description": "Mono Framework Assemblies",
99+
"url": "https://omnisharpdownload.blob.core.windows.net/ext/framework-4.6.1.zip",
100+
"installPath": "./bin/framework",
101+
"platforms": [
102+
"darwin",
103+
"linux"
157104
]
158105
},
159106
{
160-
"description": "OmniSharp (.NET Core - Ubuntu 14 / x64)",
161-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-ubuntu14-x64-netcoreapp1.0.zip",
162-
"installPath": ".omnisharp-coreclr",
163-
"runtimeIds": [
164-
"ubuntu.14.04-x64"
107+
"description": "OmniSharp (.NET 4.6 / x86)",
108+
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x86-1.9-beta19.zip",
109+
"installPath": "./bin/omnisharp",
110+
"platforms": [
111+
"win32"
165112
],
166-
"binaries": [
167-
"./OmniSharp"
113+
"architectures": [
114+
"x86",
115+
"32-bit"
168116
]
169117
},
170118
{
171-
"description": "OmniSharp (.NET Core - Ubuntu 16 / x64)",
172-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-ubuntu16-x64-netcoreapp1.0.zip",
173-
"installPath": ".omnisharp-coreclr",
174-
"runtimeIds": [
175-
"ubuntu.16.04-x64"
119+
"description": "OmniSharp (.NET 4.6 / x64)",
120+
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x64-1.9-beta19.zip",
121+
"installPath": "./bin/omnisharp",
122+
"platforms": [
123+
"win32"
176124
],
177-
"binaries": [
178-
"./OmniSharp"
125+
"architectures": [
126+
"x86_64",
127+
"64-bit"
179128
]
180129
},
181130
{
182-
"description": "OmniSharp (Mono)",
183-
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-1.9-beta19-mono.zip",
184-
"installPath": ".omnisharp-mono",
185-
"architectures": [
186-
"x86",
187-
"x86_64"
188-
],
131+
"description": "OmniSharp (Mono 4.6)",
132+
"url": "https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-mono-1.9-beta19.zip",
133+
"installPath": "./bin/omnisharp",
189134
"platforms": [
190135
"darwin",
191136
"linux"

src/omnisharp/launcher.ts

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ export interface LaunchResult {
138138
usingMono: boolean;
139139
}
140140

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

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

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

166-
const launchPath = options.path || getLaunchPath(platformInfo, kind);
166+
const launchPath = options.path || getLaunchPath(platformInfo);
167167

168168
if (platformInfo.isWindows()) {
169169
return launchWindows(launchPath, cwd, args);
170170
}
171171
else {
172-
if (kind === LaunchTargetKind.Solution) {
173-
return launchNixMono(launchPath, cwd, args);
174-
}
175-
else {
176-
return launchNix(launchPath, cwd, args);
177-
}
172+
return launchNix(launchPath, cwd, args);
178173
}
179174
});
180175
}
181176

182-
function getLaunchPath(platformInfo: PlatformInformation, kind: LaunchTargetKind): string {
183-
if (kind === LaunchTargetKind.Solution) {
184-
if (platformInfo.isWindows()) {
185-
return path.join(util.getExtensionPath(), '.omnisharp-desktop', 'OmniSharp.exe');
186-
}
177+
function getLaunchPath(platformInfo: PlatformInformation): string {
178+
const binPath = util.getBinPath();
187179

188-
return path.join(util.getExtensionPath(), '.omnisharp-mono', 'OmniSharp.exe');
189-
}
190-
191-
let basePath = path.join(util.getExtensionPath(), '.omnisharp-coreclr');
192-
if (platformInfo.isWindows()) {
193-
return path.join(basePath, 'OmniSharp.exe');
194-
}
195-
else {
196-
return path.join(basePath, 'OmniSharp');
197-
}
180+
return platformInfo.isWindows()
181+
? path.join(binPath, 'omnisharp', 'OmniSharp.exe')
182+
: path.join(binPath, 'run');
198183
}
199184

200185
function launchWindows(launchPath: string, cwd: string, args: string[]): LaunchResult {

src/omnisharp/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export abstract class OmnisharpServer {
256256

257257
this._fireEvent(Events.BeforeServerStart, solutionPath);
258258

259-
return launchOmniSharp(cwd, args, launchTarget.kind).then(value => {
259+
return launchOmniSharp(cwd, args).then(value => {
260260
if (value.usingMono) {
261261
this._logger.appendLine(`OmniSharp server started wth Mono`);
262262
}

0 commit comments

Comments
 (0)