Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OmniSharp with Sublime Text does not seem to be running OmniSharpServer

I'm trying to get ASP.NET MVC5 projects working within Sublime Text. I've installed both of the OmniSharp and Kulture sublime text plugins.

However, it doesn't appear that the OmniSharp server is running, as I'm not able to get any meaningful auto-complete options. I've followed all of the steps in this guide (except the one about the .sln files, as I don't have a .sln file, and the documentation states .proj files are automatically found).

Also, the Rename/Go To Definition options do not seem to be working at all either. Do I need to somehow start the OmniSharp server with Sublime text at all?

When I install the OmniSharp plugin within Atom (http://atom.io), I have to manually start the OmniSharp plugin (ctrl+alt+o) and then I get all the functionality as expected.

So, I'm just wondering if there is something glaringly obvious that I'm missing?

like image 423
Juzzbott Avatar asked Oct 19 '22 16:10

Juzzbott


1 Answers

I dug into the plugin code and found that the OmniSharpServer only starts when a C# file is opened. See server_runner.py in the OmniSharpSublime repository.

I changed the code to test for a solution or project.json in the current view. Try this:

import sublime_plugin

from ..lib import helpers
from ..lib import omnisharp


class OmniSharpServerRunnerEventListener(sublime_plugin.EventListener):
    def on_activated(self, view):
        if helpers.is_csharp(view) or helpers.current_solution_or_project_json_folder(view):
            omnisharp.create_omnisharp_server_subprocess(view)
like image 196
Diego Fernandez Avatar answered Nov 03 '22 02:11

Diego Fernandez