-
Notifications
You must be signed in to change notification settings - Fork 727
Description
This is probable more of an omnisharp error, but I post the problem here you guys probably know better what to do with this.
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.0-preview2-003131)
Product Information:
Version: 1.0.0-preview2-003131
Commit SHA-1 hash: 635cf40e58Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
VS Code version: 1.5.3
C# Extension version: 1.4.1
Steps to reproduce
Try to install on linux with mono flavour and a mono version <4.0.1 (or maybe no mono installed)
Expected behavior
An error should be displayed
Cannot start Omnisharp because Mono version >=4.0.1 is required.
Actual behavior
No error is displayed, the omnisharp server just hang on startup stage
Starting OmniSharp server at 10/8/2016, 7:02:23 PM
Target: /blah/blah/blah/blah.sln
How to fix
in out/omnisharp/launcher.js change
// Original code
function launchNixMono(details) {
return new Promise(function (resolve, reject) {
return canLaunchMono().then(function () {
var args = details.args.slice(0); // create copy of details.args
args.unshift(details.serverPath);
var process = child_process_1.spawn('mono', args, {
detached: false,
cwd: details.cwd
});
return resolve({
process: process,
command: details.serverPath,
usingMono: true
});
});
});
}to
// Fixed code
function launchNixMono(details) {
return new Promise(function (resolve, reject) {
canLaunchMono().then(function () {
var args = details.args.slice(0); // create copy of details.args
args.unshift(details.serverPath);
var process = child_process_1.spawn('mono', args, {
detached: false,
cwd: details.cwd
});
resolve({
process: process,
command: details.serverPath,
usingMono: true
});
}, reject);
});
}Why are they returning a promise in a promise? I think this is not how es6 Promise works, the callback of the new Promise thing should not return anything. The whole code return things inside its callback it would probably be better to rewrite them.