示例#1
0
  def _GetFiletypeCompleterForFiletype( self, filetype ):
    try:
      return self._filetype_completers[ filetype ]
    except KeyError:
      pass

    module_path = PathToFiletypeCompleterPluginLoader( filetype )
    completer = None
    supported_filetypes = [ filetype ]
    if os.path.exists( module_path ):
      module = imp.load_source( filetype, module_path )
      completer = module.GetCompleter( self._user_options )
      if completer:
        supported_filetypes.extend( completer.SupportedFiletypes() )

    for supported_filetype in supported_filetypes:
      self._filetype_completers[ supported_filetype ] = completer
    return completer
  def _GetFiletypeCompleterForFiletype( self, filetype ):
    with self._filetype_completers_lock:
      try:
        return self._filetype_completers[ filetype ]
      except KeyError:
        pass

      module_path = PathToFiletypeCompleterPluginLoader( filetype )
      completer = None
      supported_filetypes = set( [ filetype ] )
      if os.path.exists( module_path ):
        module = LoadPythonSource( filetype, module_path )
        completer = module.GetCompleter( self._user_options )
        if completer:
          supported_filetypes.update( completer.SupportedFiletypes() )

      for supported_filetype in supported_filetypes:
        self._filetype_completers[ supported_filetype ] = completer
      return completer