Minor refactoring & style cleanup

This commit is contained in:
Strahinja Val Markovic 2013-05-09 20:28:04 -07:00
parent 48281d1379
commit 2b23245422
4 changed files with 16 additions and 8 deletions

View File

@ -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(<f-args>)
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, "

View File

@ -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:

View File

@ -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':

View File

@ -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':