コード例 #1
0
ファイル: api.py プロジェクト: ChewingPencils/SublimeJEDI
    def function_definition(self):
        """
        Return the function object of the call you're currently in.

        E.g. if the cursor is here::

            abs(# <-- cursor is here

        This would return the ``abs`` function. On the other hand::

            abs()# <-- cursor is here

        This would return ``None``.

        :rtype: :class:`api_classes.CallDef`
        """

        (call, index) = self._func_call_and_param_index()
        if call is None:
            return None

        user_stmt = self._parser.user_stmt
        with common.scale_speed_settings(settings.scale_function_definition):
            _callable = lambda: evaluate.follow_call(call)
            origins = cache.cache_function_definition(_callable, user_stmt)
        debug.speed('func_call followed')

        if len(origins) == 0:
            return None
        # just take entry zero, because we need just one.
        executable = origins[0]

        return api_classes.CallDef(executable, index, call)
コード例 #2
0
ファイル: api.py プロジェクト: B-Rich/anaconda-mode
    def call_signatures(self):
        """
        Return the function object of the call you're currently in.

        E.g. if the cursor is here::

            abs(# <-- cursor is here

        This would return the ``abs`` function. On the other hand::

            abs()# <-- cursor is here

        This would return ``None``.

        :rtype: :class:`api_classes.CallDef`
        """

        call, index = self._func_call_and_param_index()
        if call is None:
            return []

        user_stmt = self._user_stmt()
        with common.scale_speed_settings(settings.scale_function_definition):
            _callable = lambda: evaluate.follow_call(call)
            origins = cache.cache_function_definition(_callable, user_stmt)
        debug.speed('func_call followed')

        return [api_classes.CallDef(o, index, call) for o in origins
                if o.isinstance(er.Function, er.Instance, er.Class)]
コード例 #3
0
ファイル: api.py プロジェクト: yonggang985/python-vim
    def call_signatures(self):
        """
        Return the function object of the call you're currently in.

        E.g. if the cursor is here::

            abs(# <-- cursor is here

        This would return the ``abs`` function. On the other hand::

            abs()# <-- cursor is here

        This would return ``None``.

        :rtype: :class:`api_classes.CallDef`
        """

        call, index = self._func_call_and_param_index()
        if call is None:
            return []

        user_stmt = self._user_stmt()
        with common.scale_speed_settings(settings.scale_function_definition):
            _callable = lambda: evaluate.follow_call(call)
            origins = cache.cache_function_definition(_callable, user_stmt)
        debug.speed('func_call followed')

        return [
            api_classes.CallDef(o, index, call) for o in origins
            if o.isinstance(er.Function, er.Instance, er.Class)
        ]