solution file detection ported
This commit is contained in:
parent
6dc4b38625
commit
a69d827934
@ -19,10 +19,10 @@
|
|||||||
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import vim
|
import vim
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
from ycm.completers.threaded_completer import ThreadedCompleter
|
from ycm.completers.threaded_completer import ThreadedCompleter
|
||||||
from ycm import vimsupport
|
from ycm import vimsupport
|
||||||
|
|
||||||
# Import stuff for Omnisharp
|
|
||||||
import urllib2
|
import urllib2
|
||||||
import urllib
|
import urllib
|
||||||
import urlparse
|
import urlparse
|
||||||
@ -68,8 +68,20 @@ class CsharpCompleter( ThreadedCompleter ):
|
|||||||
""" Start the OmniSharp server """
|
""" Start the OmniSharp server """
|
||||||
if ( not self._ServerIsRunning() ):
|
if ( not self._ServerIsRunning() ):
|
||||||
# Find the solution file
|
# Find the solution file
|
||||||
folder = vim.eval( "expand(%:p:h)" )
|
folder = os.path.dirname( vim.current.buffer.name )
|
||||||
pass
|
solutionfiles = glob.glob1( folder, "*.sln" )
|
||||||
|
while not solutionfiles:
|
||||||
|
lastfolder = folder
|
||||||
|
# Traverse up a level
|
||||||
|
folder = os.path.dirname( folder )
|
||||||
|
if folder == lastfolder:
|
||||||
|
break
|
||||||
|
solutionfiles = glob.glob1( folder, "*.sln" )
|
||||||
|
|
||||||
|
if len( solutionfiles ) == 1:
|
||||||
|
pass # start server here
|
||||||
|
else:
|
||||||
|
pass # some other stuff, like notifying
|
||||||
|
|
||||||
def _StopServer( self ):
|
def _StopServer( self ):
|
||||||
""" Stop the OmniSharp server """
|
""" Stop the OmniSharp server """
|
||||||
@ -78,7 +90,7 @@ class CsharpCompleter( ThreadedCompleter ):
|
|||||||
|
|
||||||
def _ServerIsRunning( self ):
|
def _ServerIsRunning( self ):
|
||||||
""" Check if the OmniSharp server is running """
|
""" Check if the OmniSharp server is running """
|
||||||
return True
|
return False
|
||||||
|
|
||||||
def _GetCompletions( self ):
|
def _GetCompletions( self ):
|
||||||
""" Ask server for completions """
|
""" Ask server for completions """
|
||||||
|
Loading…
x
Reference in New Issue
Block a user