style fixes

This commit is contained in:
Chiel92 2013-07-19 12:16:16 +02:00
parent a56041156e
commit 60e52f1a39

View File

@ -109,7 +109,7 @@ class CsharpCompleter( ThreadedCompleter ):
solutionfile = solutionfiles[ 0 ] solutionfile = solutionfiles[ 0 ]
else: else:
choice = vimsupport.PresentDialog( choice = vimsupport.PresentDialog(
"Which solutionfile should be loaded?", 'Which solutionfile should be loaded?',
[ str( i ) + " " + solution for i, solution in [ str( i ) + " " + solution for i, solution in
enumerate( solutionfiles ) ] ) enumerate( solutionfiles ) ] )
if choice == -1: if choice == -1:
@ -127,42 +127,47 @@ class CsharpCompleter( ThreadedCompleter ):
return return
if not platform.startswith( 'win' ): if not platform.startswith( 'win' ):
omnisharp = "mono " + omnisharp omnisharp = 'mono ' + omnisharp
solutionfile = os.path.join( folder, solutionfile ) solutionfile = os.path.join( folder, solutionfile )
# command has to be provided as one string for some reason # command has to be provided as one string for some reason
command = [ omnisharp + ' -p ' + str( self._omnisharp_port ) + ' -s ' + command = [ omnisharp + ' -p ' + str( self._omnisharp_port ) + ' -s ' +
solutionfile ] solutionfile ]
stderrLogFormat = vimsupport.GetVariableValue( "g:ycm_csharp_server_stderr_logfile_format" ) stderrLogFormat = vimsupport.GetVariableValue(
'g:ycm_csharp_server_stderr_logfile_format' )
if stderrLogFormat: if stderrLogFormat:
filename_stderr = os.path.expanduser( stderrLogFormat.format( port=self._omnisharp_port ) ) filename_stderr = os.path.expanduser(
stderrLogFormat.format( port=self._omnisharp_port ) )
else: else:
filename_stderr = os.devnull filename_stderr = os.devnull
stdoutLogFormat = vimsupport.GetVariableValue( "g:ycm_csharp_server_stdout_logfile_format" ) stdoutLogFormat = vimsupport.GetVariableValue(
'g:ycm_csharp_server_stdout_logfile_format' )
if stdoutLogFormat: if stdoutLogFormat:
filename_stdout = os.path.expanduser( stdoutLogFormat.format( port=self._omnisharp_port ) ) filename_stdout = os.path.expanduser(
stdoutLogFormat.format( port=self._omnisharp_port ) )
else: else:
filename_stdout = os.devnull filename_stdout = os.devnull
with open( filename_stderr, "w" ) as fstderr: with open( filename_stderr, 'w' ) as fstderr:
with open( filename_stdout, "w" ) as fstdout: with open( filename_stdout, 'w' ) as fstdout:
subprocess.Popen( command, stdout=fstdout, stderr=fstderr, shell=True ) subprocess.Popen( command, stdout=fstdout, stderr=fstderr, shell=True )
vimsupport.PostVimMessage( 'Starting OmniSharp server') vimsupport.PostVimMessage( 'Starting OmniSharp server' )
def _StopServer( self ): def _StopServer( self ):
""" Stop the OmniSharp server """ """ Stop the OmniSharp server """
self._GetResponse( '/stopserver' ) self._GetResponse( '/stopserver' )
vimsupport.PostVimMessage( 'Stopping OmniSharp server') vimsupport.PostVimMessage( 'Stopping OmniSharp server' )
def _ServerIsRunning( self ): def _ServerIsRunning( self ):
""" Check if the OmniSharp server is running """ """ Check if the OmniSharp server is running """
return self._GetResponse( '/checkalivestatus', silent=True ) != None return self._GetResponse( '/checkalivestatus', silent=True ) != None
def _FindFreePort( self ): def _FindFreePort( self ):
while self._ServerIsRunning(): while self._ServerIsRunning():
self._omnisharp_port += 1 self._omnisharp_port += 1