Permalink
Browse files

Add client logfile

1 parent fbe53de commit b93c1fd47c23ce57b72ba910b5d0a1ed60a057e0 @micbou micbou committed May 6, 2016
@@ -12,8 +12,8 @@ the brackets) _before_ filing your issue:**
search.][search])
- [ ] If filing a bug report, I have included the output of `vim --version`.
- [ ] If filing a bug report, I have included the output of `:YcmDebugInfo`.
-- [ ] If filing a bug report, I have included the output of
- `:YcmToggleLogs stderr`.
+- [ ] If filing a bug report, I have attached the contents of the logfiles using
+ the `:YcmToggleLogs` command.
- [ ] If filing a bug report, I have included which OS (including specific OS
version) I am using.
- [ ] If filing a bug report, I have included a minimal test case that reproduces
View
@@ -45,16 +45,16 @@ Here are the things you should do when creating an issue:
1. **Write a step-by-step procedure that when performed repeatedly reproduces
your issue.** If we can't reproduce the issue, then we can't fix it. It's
that simple.
-2. Put the following options in your vimrc:
-
+2. Add the output of [the `:YcmDebugInfo` command][ycm-debug-info-command].
+3. Put the following options in your vimrc:
```viml
- let g:ycm_server_keep_logfiles = 1
- let g:ycm_server_log_level = 'debug'
+ let g:ycm_keep_logfiles = 1
+ let g:ycm_log_level = 'debug'
```
- Run `:YcmToggleLogs stderr` in vim to open the logfile. Attach the contents
- of this file to your issue.
-3. Add the output of the `:YcmDebugInfo` command.
+ Reproduce your issue and attach the contents of the logfiles. Use [the
+ `:YcmToggleLogs` command][ycm-toggle-logs-command] to directly open them in
+ Vim.
4. **Create a test case for your issue**. This is critical. Don't talk about how
"when I have X in my file" or similar, _create a file with X in it_ and put
the contents inside code blocks in your issue description. Try to make this
@@ -112,3 +112,5 @@ Creating good pull requests
[build-bots]: https://travis-ci.org/Valloric/YouCompleteMe
[ycm-users]: https://groups.google.com/forum/?hl=en#!forum/ycm-users
[gitter]: https://gitter.im/Valloric/YouCompleteMe
+[ycm-debug-info-command]: https://github.com/Valloric/YouCompleteMe#the-ycmdebuginfo-command
+[ycm-toggle-logs-command]: https://github.com/Valloric/YouCompleteMe#the-ycmtogglelogs-command
View
@@ -1152,12 +1152,9 @@ completion engine.
### The `:YcmToggleLogs` command
-This command automatically opens in windows the stdout and stderr logfiles
-written by the [ycmd server][ycmd]. If one or both logfiles are already opened,
-they are automatically closed. `stderr` or `stdout` can be specified as an
-argument of this command to only open the corresponding logfile instead of both.
-If this logfile is already opened, it will be closed. Only for debugging
-purpose.
+This command opens in separate windows the logfiles given as arguments or closes
+them if they are already open in the editor. When no argument is given, list the
+available logfiles. Only for debugging purpose.
### The `:YcmCompleter` command
@@ -2022,23 +2019,24 @@ Default: `''`
let g:ycm_server_python_interpreter = ''
```
-### The `g:ycm_server_keep_logfiles` option
+### The `g:ycm_keep_logfiles` option
-When this option is set to `1`, the [ycmd completion server][ycmd] will keep the
-logfiles around after shutting down (they are deleted on shutdown by default).
+When this option is set to `1`, YCM and the [ycmd completion server][ycmd] will
+keep the logfiles around after shutting down (they are deleted on shutdown by
+default).
To see where the logfiles are, call `:YcmDebugInfo`.
Default: `0`
```viml
-let g:ycm_server_keep_logfiles = 0
+let g:ycm_keep_logfiles = 0
```
-### The `g:ycm_server_log_level` option
+### The `g:ycm_log_level` option
-The logging level that the [ycmd completion server][ycmd] uses. Valid values are
-the following, from most verbose to least verbose:
+The logging level that YCM and the [ycmd completion server][ycmd] use. Valid
+values are the following, from most verbose to least verbose:
- `debug`
- `info`
- `warning`
@@ -2050,7 +2048,7 @@ Note that `debug` is _very_ verbose.
Default: `info`
```viml
-let g:ycm_server_log_level = 'info'
+let g:ycm_log_level = 'info'
```
### The `g:ycm_auto_start_csharp_server` option
@@ -2499,10 +2497,10 @@ the message log if it encounters problems. It's likely you misconfigured
something and YCM is complaining about it.
Also, you may want to run the `:YcmDebugInfo` command; it will make YCM spew out
-various debugging information, including the [ycmd][] logfile paths and the
-compile flags for the current file if the file is a C-family language file and
-you have compiled in Clang support. Logfiles can be automatically opened in the
-editor using the `:YcmToggleLogs` command.
+various debugging information, including the YCM and [ycmd][] logfile paths and
+the compile flags for the current file if the file is a C-family language file
+and you have compiled in Clang support. Logfiles can be opened in the editor
+using [the `:YcmToggleLogs` command](#the-ycmtogglelogs-command).
### Sometimes it takes much longer to get semantic completions than normal
@@ -374,7 +374,7 @@ function! s:SetUpCommands()
command! YcmRestartServer call s:RestartServer()
command! YcmShowDetailedDiagnostic call s:ShowDetailedDiagnostic()
command! YcmDebugInfo call s:DebugInfo()
- command! -nargs=? -complete=custom,youcompleteme#LogsComplete
+ command! -nargs=* -complete=custom,youcompleteme#LogsComplete
\ YcmToggleLogs call s:ToggleLogs(<f-args>)
command! -nargs=* -complete=custom,youcompleteme#SubCommandsComplete
\ YcmCompleter call s:CompleterCommand(<f-args>)
@@ -454,6 +454,7 @@ function! s:OnBufferReadPre(filename)
endif
endfunction
+
function! s:OnBufferRead()
" We need to do this even when we are not allowed to complete in the current
" buffer because we might be allowed to complete in the future! The canonical
@@ -787,11 +788,7 @@ endfunction
function! s:ToggleLogs(...)
- let stderr = a:0 == 0 || a:1 !=? 'stdout'
- let stdout = a:0 == 0 || a:1 !=? 'stderr'
- exec s:python_command "ycm_state.ToggleLogs("
- \ "stdout = vimsupport.GetBoolValue( 'l:stdout' ),"
- \ "stderr = vimsupport.GetBoolValue( 'l:stderr' ) )"
+ exec s:python_command "ycm_state.ToggleLogs( *vim.eval( 'a:000' ) )"
endfunction
@@ -827,13 +824,12 @@ endfunction
function! youcompleteme#LogsComplete( arglead, cmdline, cursorpos )
- return "stdout\nstderr"
+ return join( s:Pyeval( 'list( ycm_state.GetLogfiles() )' ), "\n" )
endfunction
function! youcompleteme#SubCommandsComplete( arglead, cmdline, cursorpos )
- return join( s:Pyeval( 'ycm_state.GetDefinedSubcommands()' ),
- \ "\n")
+ return join( s:Pyeval( 'ycm_state.GetDefinedSubcommands()' ), "\n" )
endfunction
View
@@ -100,8 +100,8 @@ Contents ~
21. The |g:ycm_seed_identifiers_with_syntax| option
22. The |g:ycm_extra_conf_vim_data| option
23. The |g:ycm_server_python_interpreter| option
- 24. The |g:ycm_server_keep_logfiles| option
- 25. The |g:ycm_server_log_level| option
+ 24. The |g:ycm_keep_logfiles| option
+ 25. The |g:ycm_log_level| option
26. The |g:ycm_auto_start_csharp_server| option
27. The |g:ycm_auto_stop_csharp_server| option
28. The |g:ycm_csharp_server_port| option
@@ -1418,12 +1418,9 @@ semantic completion engine.
-------------------------------------------------------------------------------
The *:YcmToggleLogs* command
-This command automatically opens in windows the stdout and stderr logfiles
-written by the ycmd server [43]. If one or both logfiles are already opened,
-they are automatically closed. 'stderr' or 'stdout' can be specified as an
-argument of this command to only open the corresponding logfile instead of
-both. If this logfile is already opened, it will be closed. Only for debugging
-purpose.
+This command opens in separate windows the logfiles given as arguments or
+closes them if they are already open in the editor. When no argument is given,
+list the available logfiles. Only for debugging purpose.
-------------------------------------------------------------------------------
The *:YcmCompleter* command
@@ -2285,29 +2282,30 @@ Default: "''"
let g:ycm_server_python_interpreter = ''
<
-------------------------------------------------------------------------------
-The *g:ycm_server_keep_logfiles* option
+The *g:ycm_keep_logfiles* option
-When this option is set to '1', the ycmd completion server [43] will keep the
-logfiles around after shutting down (they are deleted on shutdown by default).
+When this option is set to '1', YCM and the ycmd completion server [43] will
+keep the logfiles around after shutting down (they are deleted on shutdown by
+default).
To see where the logfiles are, call |:YcmDebugInfo|.
Default: '0'
>
- let g:ycm_server_keep_logfiles = 0
+ let g:ycm_keep_logfiles = 0
<
-------------------------------------------------------------------------------
-The *g:ycm_server_log_level* option
+The *g:ycm_log_level* option
-The logging level that the ycmd completion server [43] uses. Valid values are
-the following, from most verbose to least verbose: - 'debug' - 'info' -
-'warning' - 'error' - 'critical'
+The logging level that YCM and the ycmd completion server [43] use. Valid
+values are the following, from most verbose to least verbose: - 'debug' -
+'info' - 'warning' - 'error' - 'critical'
Note that 'debug' is _very_ verbose.
Default: 'info'
>
- let g:ycm_server_log_level = 'info'
+ let g:ycm_log_level = 'info'
<
-------------------------------------------------------------------------------
The *g:ycm_auto_start_csharp_server* option
@@ -2741,9 +2739,9 @@ to the message log if it encounters problems. It's likely you misconfigured
something and YCM is complaining about it.
Also, you may want to run the |:YcmDebugInfo| command; it will make YCM spew
-out various debugging information, including the ycmd [43] logfile paths and
-the compile flags for the current file if the file is a C-family language file
-and you have compiled in Clang support. Logfiles can be automatically opened in
+out various debugging information, including the YCM and ycmd [43] logfile
+paths and the compile flags for the current file if the file is a C-family
+language file and you have compiled in Clang support. Logfiles can be opened in
the editor using the |:YcmToggleLogs| command.
-------------------------------------------------------------------------------
@@ -80,11 +80,13 @@ let g:ycm_key_detailed_diagnostics =
let g:ycm_cache_omnifunc =
\ get( g:, 'ycm_cache_omnifunc', 1 )
-let g:ycm_server_log_level =
- \ get( g:, 'ycm_server_log_level', 'info' )
+let g:ycm_log_level =
+ \ get( g:, 'ycm_log_level',
+ \ get( g:, 'ycm_server_log_level', 'info' ) )
-let g:ycm_server_keep_logfiles =
- \ get( g:, 'ycm_server_keep_logfiles', 0 )
+let g:ycm_keep_logfiles =
+ \ get( g:, 'ycm_keep_logfiles',
+ \ get( g:, 'ycm_server_keep_logfiles', 0 ) )
let g:ycm_extra_conf_vim_data =
\ get( g:, 'ycm_extra_conf_vim_data', [] )
@@ -40,7 +40,8 @@
# thus are not part of default_options.json, but are required for a working
# YouCompleteMe object.
DEFAULT_CLIENT_OPTIONS = {
- 'server_log_level': 'info',
+ 'log_level': 'info',
+ 'keep_logfiles': 0,
'extra_conf_vim_data': [],
'show_diagnostics_ui': 1,
'enable_diagnostic_signs': 1,
@@ -80,6 +81,14 @@ def _WaitUntilReady( timeout = 5 ):
time.sleep( 0.1 )
+def StopServer( ycm ):
+ try:
+ ycm.OnVimLeave()
+ WaitUntilProcessIsTerminated( ycm._server_popen )
+ except Exception:
+ pass
+
+
def YouCompleteMeInstance( custom_options = {} ):
"""Defines a decorator function for tests that passes a unique YouCompleteMe
instance as a parameter. This instance is initialized with the default options
@@ -92,8 +101,8 @@ def YouCompleteMeInstance( custom_options = {} ):
from ycm.tests import YouCompleteMeInstance
- @YouCompleteMeInstance( { 'server_log_level': 'debug',
- 'server_keep_logfiles': 1 } )
+ @YouCompleteMeInstance( { 'log_level': 'debug',
+ 'keep_logfiles': 1 } )
def Debug_test( ycm ):
...
"""
@@ -105,7 +114,6 @@ def Wrapper( *args, **kwargs ):
try:
test( ycm, *args, **kwargs )
finally:
- ycm.OnVimLeave()
- WaitUntilProcessIsTerminated( ycm._server_popen )
+ StopServer( ycm )
return Wrapper
return Decorator
@@ -176,7 +176,7 @@ def MockVimCommand( command ):
class VimBuffer( object ):
"""An object that looks like a vim.buffer object:
- - |name| : full path of the buffer;
+ - |name| : full path of the buffer with symbolic links resolved;
- |number| : buffer number;
- |contents|: list of lines representing the buffer contents;
- |filetype|: buffer filetype. Empty string if no filetype is set;
@@ -191,7 +191,7 @@ def __init__( self, name,
modified = True,
window = None,
omnifunc = '' ):
- self.name = name
+ self.name = os.path.realpath( name ) if name else ''
self.number = number
self.contents = contents
self.filetype = filetype
Oops, something went wrong.

0 comments on commit b93c1fd

Please sign in to comment.