Optionally write OmniSharp stdout and stderr to log files

This commit is contained in:
Spencer G. Jones 2013-07-12 14:46:33 -06:00
parent a6a9fa10c3
commit 3737ca2ef4
2 changed files with 22 additions and 2 deletions

View File

@ -157,6 +157,13 @@ let g:ycm_auto_start_csharp_server =
let g:ycm_csharp_server_port = let g:ycm_csharp_server_port =
\ get( g:, 'ycm_csharp_server_port', 2000 ) \ get( g:, 'ycm_csharp_server_port', 2000 )
let g:ycm_csharp_server_stderr_logfile_format =
\ get( g:, 'ycm_csharp_server_stderr_logfile_format', '' )
let g:ycm_csharp_server_stdout_logfile_format =
\ get( g:, 'ycm_csharp_server_stdout_logfile_format', '' )
" On-demand loading. Let's use the autoload folder and not slow down vim's " On-demand loading. Let's use the autoload folder and not slow down vim's
" startup procedure. " startup procedure.
augroup youcompletemeStart augroup youcompletemeStart

View File

@ -108,8 +108,21 @@ class CsharpCompleter( ThreadedCompleter ):
# 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.OmniSharpPort ) + ' -s ' + solutionfile ] command = [ omnisharp + ' -p ' + str( self.OmniSharpPort ) + ' -s ' + solutionfile ]
with open( os.devnull, "w" ) as fnull: stderrLogFormat = vimsupport.GetVariableValue( "g:ycm_csharp_server_stderr_logfile_format" )
subprocess.Popen( command, stdout = fnull, stderr = fnull, shell=True ) if stderrLogFormat:
fstderr = open( os.path.expanduser( stderrLogFormat.format( port=self.OmniSharpPort ) ), "w" )
else:
fstderr = open( os.devnull, "w" )
stdoutLogFormat = vimsupport.GetVariableValue( "g:ycm_csharp_server_stdout_logfile_format" )
if stdoutLogFormat:
fstdout = open( os.path.expanduser( stdoutLogFormat.format( port=self.OmniSharpPort ) ), "w" )
else:
fstdout = open( os.devnull, "w" )
with fstderr as fstderr:
with fstdout as fstdout:
subprocess.Popen( command, stdout=fstdout, stderr=fstderr, shell=True )
def _StopServer( self ): def _StopServer( self ):
""" Stop the OmniSharp server """ """ Stop the OmniSharp server """