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

Provide a command to easily install and update OmniSharp Roslyn #382

Merged
merged 4 commits into from
Jul 25, 2018
Merged

Provide a command to easily install and update OmniSharp Roslyn #382

merged 4 commits into from
Jul 25, 2018

Conversation

axvr
Copy link
Contributor

@axvr axvr commented Jul 24, 2018

Improve usability by adding a simple way of installing the OmniSharp Roslyn server.

This command currently only works on Linux, macOS, Cygwin and WSL. Windows support could be added in the future through the use of a simple PowerShell script.

For the installation to take place the user will also have to have Curl installed on their machine. This is intentional to avoid omnisharp-vim needing to know where it is installed to on the user's machine.

Running the command again will update the existing server, after stopping all running instances.

You may want to move the script used somewhere else (e.g. the OmniSharp GitHub organisation), if you are unhappy with it being in my personal repo. I have licenced the script under the Unlicence, so feel free to do so. The script could also be used in other OmniSharp editor plugins.

Potential enhancements could include:

  • Automatically setting g:OmniSharp_server_path if server is found under the path which the installer installs it to.
  • Auto-install the server if it cannot be found.

I am open to all suggestions and improvements :)

This command currently only works on Linux, macOS, Cygwin and WSL.
Windows support could be added in the future through the use of a simple
PowerShell script.

For the installation to take place the user will also have to have Curl
installed on their machine.

Running the command again will update the existing server, after
stopping all running instances.
@nickspoons
Copy link
Member

Great stuff @axvr, thanks!

I do think it would be good to have the script locally in this repo, so future devs can easily modify it themselves if things change - and if anyone wants to write a Windows version then the two will be in the same place which will be helpful.

As far as I know other O# editors already have their own versions of this - VSCode has some kind of install system and Emacs has also has a process for getting the latest roslyn. However if we add the script to this repo, we can always migrate it to a more generic OmniSharp repo later (perhaps even add it directly to OmniSharp-roslyn?). How does that sound to you?

I think we should also make the installed server path ~/.omnisharp/vim/run the default, when the user doesn't have a g:OmniSharp_server_path setting. Currently there is some old and unused code in autoload/OmniSharp/util.vim which sets the default server path. This is a leftover from when the 2 servers server (the original OmniSharp server) and roslyn were both managed as git submodules of this repo, and needed to be compiled, which was problematic and slow on many systems. So we could replace that whole if block with a quick check to see whether ~/.omnisharp/vim/run exists, and if not, run :OmniSharpInstall - perhaps after prompting the user?

@willl
Copy link
Member

willl commented Jul 25, 2018

Yeah, Emacs implemented something along those lines a little while ago:
OmniSharp/omnisharp-emacs#275

If it helps, here's their PR that added Windows support: OmniSharp/omnisharp-emacs#330

@nickspoons nickspoons merged commit c1f65d4 into OmniSharp:master Jul 25, 2018
@nickspoons
Copy link
Member

Thanks, this is really going to help people get up and running easily!

@axvr
Copy link
Contributor Author

axvr commented Jul 25, 2018

@nickspoons, thanks! If I have time over the next couple of days I'll try and get around to:

  • Updating the README,
  • Setting a default server path,
  • Creating a prompt to install the server if is wasn't found,
  • Starting work on the Windows install script.

@nickspoons
Copy link
Member

@axvr I was actually just getting started on some of that now - not the Windows script but the other 3 points.

I'm thinking of moving the default install location from ~/.omnisharp/vim to ~/.omnisharp/omnisharp-roslyn to reduce confusion - the install was initiated from vim, but it's omnisharp-roslyn that has been downloaded into the folder.

I'll make a PR and you can tell me what you think.

@axvr
Copy link
Contributor Author

axvr commented Jul 25, 2018

@nickspoons, great idea. I had originally used the location ~/.omnisharp/vim in case another editor was using the ~/.omnisharp directory, but your way actually makes a lot more sense.

@stevearc
Copy link
Contributor

Nice work @axvr! I was starting to work on similar functionality, but you're much faster 😁

The direction I was going was extending the python part of the plugin to do the download & extraction, with the benefit being that it's cross-platform. If you're interested, I could look into integrating that as an alternative to figuring out a powershell install script?

@axvr
Copy link
Contributor Author

axvr commented Jul 26, 2018

@stevearc, to be honest, I don't think it will take too long to write a PowerShell version of the install script because I believe that Microsoft have already implemented all of commands that are required for the installation.

The script I created is was designed to be general purpose, it is capable of installing the mono version of the server, the standard version of the server, the HTTP version, and any previous releases of the server. This was done to allow it to be used in other OmniSharp editor plugins, especially as I wrote it in a language native to the *nix family of OSs, and was planning on writing a PowerShell variant for MS Windows. At the moment the script may not be of much use (except here), but if more editor plugins are created for other editors it may be useful.

I had originally attempted to write the installer in vim script but I found that it was difficult to debug and made the code more complex than it needed to be (lots of system() calls and conditional statements). Personally I prefer the approach of having small individual programs working together to achieve a single goal.

But if you wan't to try writing it in Python instead, be my guest, I'll happily take an unbiased look at it. 🙂

@stevearc
Copy link
Contributor

Since you think the PS script won't be difficult, I'll leave you to it. Thanks again for adding this!

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.

4 participants