diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index fd991d50..7ff76d8c 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -600,6 +600,7 @@ function! s:CompleterCommand(...) py completer.OnUserCommand( vim.eval( 'l:arguments' ) ) endfunction + function! youcompleteme#OpenGoToList() set lazyredraw cclose @@ -609,14 +610,17 @@ function! youcompleteme#OpenGoToList() redraw! endfunction + command! -nargs=* -complete=custom,youcompleteme#SubCommandsComplete \ YcmCompleter call s:CompleterCommand() + function! youcompleteme#SubCommandsComplete( arglead, cmdline, cursorpos ) return join( pyeval( 'ycm_state.GetFiletypeCompleter().DefinedSubcommands()' ), \ "\n") endfunction + function! s:ForceCompile() if !pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' ) echom "Native filetype completion not supported for current file, " diff --git a/python/completers/completer.py b/python/completers/completer.py index 0523a8e3..f6a2c516 100644 --- a/python/completers/completer.py +++ b/python/completers/completer.py @@ -180,13 +180,15 @@ class Completer( object ): return [] - def UserCommandsHelpMessage( self ): - if self.DefinedSubcommands(): - vimsupport.EchoText( "Supported commands are:\n" + - '\n'.join( self.DefinedSubcommands() )+ - "\nSee the docs for information on what they do." ) + def EchoUserCommandsHelpMessage( self ): + subcommands = self.DefinedSubcommands() + if subcommands: + vimsupport.EchoText( 'Supported commands are:\n' + + '\n'.join( subcommands ) + + '\nSee the docs for information on what they do.' ) else: - vimsupport.EchoText( "No supported subcommands" ) + vimsupport.EchoText( 'No supported subcommands' ) + def FilterAndSortCandidates( self, candidates, query ): if not candidates: diff --git a/python/completers/cpp/clang_completer.py b/python/completers/cpp/clang_completer.py index c2377d8c..8e689321 100644 --- a/python/completers/cpp/clang_completer.py +++ b/python/completers/cpp/clang_completer.py @@ -132,7 +132,8 @@ class ClangCompleter( Completer ): def OnUserCommand( self, arguments ): if not arguments: - return self.UserCommandsHelpMessage() + self.EchoUserCommandsHelpMessage() + return command = arguments[ 0 ] if command == 'GoToDefinition': diff --git a/python/completers/python/jedi_completer.py b/python/completers/python/jedi_completer.py index a1316e94..50444f4c 100644 --- a/python/completers/python/jedi_completer.py +++ b/python/completers/python/jedi_completer.py @@ -81,7 +81,8 @@ class JediCompleter( ThreadedCompleter ): def OnUserCommand( self, arguments ): if not arguments: - return self.UserCommandsHelpMessage() + self.EchoUserCommandsHelpMessage() + return command = arguments[ 0 ] if command == 'GoToDefinition':