Skip to content

Conversation

@DustinCampbell
Copy link
Member

While @rchande and I were investigating a different issue, we noticed that OmniSharp was always being launched with the run script when "omnisharp.path" is set to "latest". Essentially, it would only try to launch OmniSharp on the globally-installed Mono if the user hasn't set "omnisharp.path" at all, which really isn't what we want.

Here are the desired behaviors for Linux/OSX:

  1. If the user hasn't set "omnisharp.path" at all, launch the default OmniSharp. If a valid version of Mono is installed, launch with Mono; otherwise, use the run script.
  2. If the user has set "omnisharp.path" to an absolute path, assume that path is OmniSharp and launch it. If the user also sets "omnisharp.useMono" to true, launch with Mono. If a valid version of Mono can't be found, throw an error.
  3. If the user has set "omnisharp.path" to a version or "latest", first, ensure the appropriate version of OmniSharp is downloaded. Then, if a valid version of Mono is installed, launch with Mono; otherwise, use the run script.

This change fixes #3 above.

As part of this change, I've done a bit of refactoring to simplify things a bit. The OmniSharpManager has been changed to return two paths: the path to the run script, and the path to launch with Mono. In addition, the calculation of the path to the default OmniSharp has been pushed into the OmniSharpManager. The launcher code has also been simplified a bit. Finally, I changed the logging to only say "started with Mono" if OmniSharp was actually launched with Mono, and I added the version number of Mono.

@codecov
Copy link

codecov bot commented Apr 25, 2018

Codecov Report

Merging #2221 into master will increase coverage by 0.52%.
The diff coverage is 52.3%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2221      +/-   ##
=========================================
+ Coverage   59.08%   59.6%   +0.52%     
=========================================
  Files          77      77              
  Lines        3759    3748      -11     
  Branches      547     544       -3     
=========================================
+ Hits         2221    2234      +13     
+ Misses       1367    1343      -24     
  Partials      171     171
Flag Coverage Δ
#integration 50.87% <49.23%> (+0.49%) ⬆️
#unit 82.61% <100%> (ø) ⬆️
Impacted Files Coverage Δ
src/omnisharp/loggingEvents.ts 100% <100%> (ø) ⬆️
src/observers/OmnisharpLoggerObserver.ts 100% <100%> (ø) ⬆️
src/omnisharp/OmnisharpManager.ts 48.27% <33.33%> (+0.12%) ⬆️
src/omnisharp/launcher.ts 56.45% <48.48%> (+13.06%) ⬆️
src/omnisharp/server.ts 72.04% <81.81%> (+0.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8130fb7...3e3b234. Read the comment docs.


return launchOmniSharp(cwd, args, launchPath).then(async value => {
this.eventStream.post(new ObservableEvents.OmnisharpLaunch(value.usingMono, value.command, value.process.pid));
return launchOmniSharp(cwd, args, launchInfo).then(async launchResult => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use async await here as well ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@DustinCampbell
Copy link
Member Author

DustinCampbell commented Apr 26, 2018

Hmmm... I"m not sure what's up with codecov. It seems to show lots of uncovered blocks in OmniSharpManager.ts, but those blocks are clearly covered by feature tests. It's especially confusing that the report shows increased coverage or no change in all impacted files. Weird!

@TheRealPiotrP, is this a known issue?

Edit: Also, looking at the report, I see #unit and #integration, but no #feature. Are some tests not participating in the coverage reporting?

@akshita31
Copy link
Contributor

@DustinCampbell We do not have code coverage for feature tests right now. I have created an issue and will look into it - #2227

@DustinCampbell
Copy link
Member Author

Thanks @akshita31! Are you all ok if I go ahead and merge this in that case? The OmniSharpManager.ts file is really quite well-covered if feature tests are included.

@akshita31
Copy link
Contributor

@DustinCampbell Sure go ahead 😀

@DustinCampbell DustinCampbell merged commit 3907ecd into dotnet:master Apr 26, 2018
@DustinCampbell DustinCampbell deleted the fix-omnisharp-launch branch April 26, 2018 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants