From 6430677f4feb6088fc6f5ac45c3b7d007859dc80 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Mon, 7 May 2012 21:23:38 -0700 Subject: [PATCH] Whitespace changes --- python/ycm.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/ycm.py b/python/ycm.py index 6747a637..d7bcbb20 100644 --- a/python/ycm.py +++ b/python/ycm.py @@ -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."""