choice for multiple solutionfiles implemented

This commit is contained in:
Chiel92 2013-07-07 13:28:28 +02:00
parent 2743f96529
commit d2a7fe9c0e

View File

@ -84,20 +84,22 @@ class CsharpCompleter( ThreadedCompleter ):
elif len( solutionfiles ) == 1: elif len( solutionfiles ) == 1:
solutionfile = solutionfiles[0] solutionfile = solutionfiles[0]
else: else:
# This still has to be caught by giving the user a choice choice = vimsupport.PresentDialog( "Which solutionfile should be loaded?",
vimsupport.PostVimMessage( 'Error starting OmniSharp server: multiple solutionfiles found' ) [ str(i) + " " + s for i, s in enumerate( solutionfiles ) ] )
return if choice == -1:
vimsupport.PostVimMessage( 'OmniSharp not started' )
return
else:
solutionfile = solutionfiles[ choice ]
omnisharp = os.path.join( os.path.abspath( os.path.dirname( __file__ ) ), omnisharp = os.path.join( os.path.abspath( os.path.dirname( __file__ ) ),
'OmniSharpServer/OmniSharp/bin/Debug/OmniSharp.exe' ) 'OmniSharpServer/OmniSharp/bin/Debug/OmniSharp.exe' )
solutionfile = os.path.join ( folder, solutionfile ) solutionfile = os.path.join ( folder, solutionfile )
# command has to be provided as one string # command has to be provided as one string for some reason
command = [ omnisharp + ' -p ' + str( self.OmniSharpPort ) + ' -s ' + solutionfile ] command = [ omnisharp + ' -p ' + str( self.OmniSharpPort ) + ' -s ' + solutionfile ]
vimsupport.PostVimMessage( 'starting server...\n' + ' '.join( command ) ) with open( os.devnull, "w" ) as fnull:
subprocess.Popen( command, stdout = fnull, stderr = fnull, shell=True )
with open(os.devnull, "w") as fnull:
result = subprocess.Popen(command, stdout = fnull, stderr = fnull, shell=True)
def _StopServer( self ): def _StopServer( self ):
""" Stop the OmniSharp server """ """ Stop the OmniSharp server """