Whitespace changes

This commit is contained in:
Strahinja Val Markovic 2012-05-07 21:23:38 -07:00
parent 5f5b9bd7b4
commit 6430677f4f

View File

@ -23,6 +23,7 @@ import indexer
min_num_chars = int( vim.eval( "g:ycm_min_num_of_chars_for_completion" ) )
class CompletionSystem( object ):
def __init__( self ):
self.completer = indexer.Completer()
@ -30,15 +31,18 @@ class CompletionSystem( object ):
self.pattern = re.compile( r"[_a-zA-Z]\w*" )
self.future = None
def CandidatesForQueryAsync( self, query ):
filetype = vim.eval( "&filetype" )
self.future = self.completer.CandidatesForQueryAndTypeAsync(
SanitizeQuery( query ),
filetype )
def AsyncCandidateRequestReady( self ):
return self.future.ResultsReady()
def CandidatesFromStoredRequest( self ):
if not self.future:
return []
@ -47,6 +51,7 @@ class CompletionSystem( object ):
self.future.GetResults( results )
return results
def AddBufferIdentifiers( self ):
text = "\n".join( vim.current.buffer )
text = RemoveIdentFreeText( text )
@ -60,10 +65,12 @@ class CompletionSystem( object ):
self.completer.AddCandidatesToDatabase( idents, filetype, filepath )
def CurrentColumn():
# vim's columns start at 1 while vim.current.line columns start at 0
return int( vim.eval( "col('.')" ) ) - 1
def CompletionStartColumn():
line = vim.current.line
current_column = CurrentColumn()
@ -77,9 +84,11 @@ def CompletionStartColumn():
return start_column
def EscapeForVim( text ):
return text.replace( "'", "''" )
def CurrentCursorText():
start_column = CompletionStartColumn()
current_column = CurrentColumn()
@ -94,6 +103,7 @@ def CurrentCursorText():
def SanitizeQuery( query ):
return query.strip()
def RemoveIdentFreeText( text ):
"""Removes commented-out code and code in quotes."""