Check for a native completer with multiple filetypes

GetFiletypeCompleter would always return a omnicompleter for the first
filetype in case there was no native completer, and the lookup would
stop.

This changes that behaviour to get all possible completers and tries to
find a native one among them. If no native completer is found, it
returns the omnicompleter for the first filetypes, as it used to.
This commit is contained in:
Zeh Rizzatti 2013-03-02 22:14:22 -04:00
parent 1acd3e84c7
commit ac1e04fc14

View File

@ -60,11 +60,19 @@ class YouCompleteMe( object ):
def GetFiletypeCompleter( self ):
filetypes = vimsupport.CurrentFiletypes()
for filetype in filetypes:
completer = self.GetFiletypeCompleterForFiletype( filetype )
if completer:
completers = [self.GetFiletypeCompleterForFiletype( filetype )
for filetype in filetypes ]
if not completers:
return None
# Try to find a native completer first
for completer in completers:
if completer and completer is not self.omnicomp:
return completer
return None
# Return the omni completer for the first filetype
return completers[0]
def GetFiletypeCompleterForFiletype( self, filetype ):