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' ) ) py completer.OnUserCommand( vim.eval( 'l:arguments' ) )
endfunction endfunction
function! youcompleteme#OpenGoToList() function! youcompleteme#OpenGoToList()
set lazyredraw set lazyredraw
cclose cclose
@ -609,14 +610,17 @@ function! youcompleteme#OpenGoToList()
redraw! redraw!
endfunction endfunction
command! -nargs=* -complete=custom,youcompleteme#SubCommandsComplete command! -nargs=* -complete=custom,youcompleteme#SubCommandsComplete
\ YcmCompleter call s:CompleterCommand(<f-args>) \ YcmCompleter call s:CompleterCommand(<f-args>)
function! youcompleteme#SubCommandsComplete( arglead, cmdline, cursorpos ) function! youcompleteme#SubCommandsComplete( arglead, cmdline, cursorpos )
return join( pyeval( 'ycm_state.GetFiletypeCompleter().DefinedSubcommands()' ), return join( pyeval( 'ycm_state.GetFiletypeCompleter().DefinedSubcommands()' ),
\ "\n") \ "\n")
endfunction endfunction
function! s:ForceCompile() function! s:ForceCompile()
if !pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' ) if !pyeval( 'ycm_state.NativeFiletypeCompletionUsable()' )
echom "Native filetype completion not supported for current file, " echom "Native filetype completion not supported for current file, "

View File

@ -180,13 +180,15 @@ class Completer( object ):
return [] return []
def UserCommandsHelpMessage( self ): def EchoUserCommandsHelpMessage( self ):
if self.DefinedSubcommands(): subcommands = self.DefinedSubcommands()
vimsupport.EchoText( "Supported commands are:\n" + if subcommands:
'\n'.join( self.DefinedSubcommands() )+ vimsupport.EchoText( 'Supported commands are:\n' +
"\nSee the docs for information on what they do." ) '\n'.join( subcommands ) +
'\nSee the docs for information on what they do.' )
else: else:
vimsupport.EchoText( "No supported subcommands" ) vimsupport.EchoText( 'No supported subcommands' )
def FilterAndSortCandidates( self, candidates, query ): def FilterAndSortCandidates( self, candidates, query ):
if not candidates: if not candidates:

View File

@ -132,7 +132,8 @@ class ClangCompleter( Completer ):
def OnUserCommand( self, arguments ): def OnUserCommand( self, arguments ):
if not arguments: if not arguments:
return self.UserCommandsHelpMessage() self.EchoUserCommandsHelpMessage()
return
command = arguments[ 0 ] command = arguments[ 0 ]
if command == 'GoToDefinition': if command == 'GoToDefinition':

View File

@ -81,7 +81,8 @@ class JediCompleter( ThreadedCompleter ):
def OnUserCommand( self, arguments ): def OnUserCommand( self, arguments ):
if not arguments: if not arguments:
return self.UserCommandsHelpMessage() self.EchoUserCommandsHelpMessage()
return
command = arguments[ 0 ] command = arguments[ 0 ]
if command == 'GoToDefinition': if command == 'GoToDefinition':