diff --git a/plugin/youcompleteme.vim b/plugin/youcompleteme.vim index 70c5e33d..2e9efff3 100644 --- a/plugin/youcompleteme.vim +++ b/plugin/youcompleteme.vim @@ -157,6 +157,13 @@ let g:ycm_auto_start_csharp_server = let g:ycm_csharp_server_port = \ 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 " startup procedure. augroup youcompletemeStart diff --git a/python/ycm/completers/cs/cs_completer.py b/python/ycm/completers/cs/cs_completer.py index fbc1c230..b314916f 100755 --- a/python/ycm/completers/cs/cs_completer.py +++ b/python/ycm/completers/cs/cs_completer.py @@ -108,8 +108,21 @@ class CsharpCompleter( ThreadedCompleter ): # command has to be provided as one string for some reason command = [ omnisharp + ' -p ' + str( self.OmniSharpPort ) + ' -s ' + solutionfile ] - with open( os.devnull, "w" ) as fnull: - subprocess.Popen( command, stdout = fnull, stderr = fnull, shell=True ) + stderrLogFormat = vimsupport.GetVariableValue( "g:ycm_csharp_server_stderr_logfile_format" ) + 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 ): """ Stop the OmniSharp server """