def do_get_completions(self, text, act_tok): """Retrieves completion options. Returns the array with completion options tuples. :param text: the full text of the expression to complete :param act_tok: resolved part of the expression :return: the array of tuples `(name, documentation, args, ret_type)` :Example: Let us execute ``import time`` line in the Python console. Then try to complete ``time.sle`` expression. At this point the method would receive ``time.sle`` as ``text`` parameter and ``time.`` as ``act_tok`` parameter. The result would contain the array with the following tuple among others: ``[..., ('sleep', 'sleep(seconds)\\n\\nDelay execution ...', '(seconds)', '2'), ...]``. """ try: from _pydev_bundle._pydev_completer import Completer completer = Completer(self.get_namespace(), None) return completer.complete(act_tok) except: import traceback traceback.print_exc() return []
def getCompletions(self, text, act_tok): try: from _pydev_bundle._pydev_completer import Completer completer = Completer(self.namespace, None) return completer.complete(act_tok) except: pydev_log.exception() return []
def getCompletions(self, text, act_tok): try: from _pydev_bundle._pydev_completer import Completer completer = Completer(self.namespace, None) return completer.complete(act_tok) except: import traceback traceback.print_exc() return []
def getCompletions(self, text, act_tok): # Get completions from IPython and from PyDev and merge the results # IPython only gives context free list of completions, while PyDev # gives detailed information about completions. try: TYPE_IPYTHON = '11' TYPE_IPYTHON_MAGIC = '12' _line, ipython_completions = self.complete(text) from _pydev_bundle._pydev_completer import Completer completer = Completer(self.get_namespace(), None) ret = completer.complete(act_tok) append = ret.append ip = self.ipython pydev_completions = set([f[0] for f in ret]) for ipython_completion in ipython_completions: #PyCharm was not expecting completions with '%'... #Could be fixed in the backend, but it's probably better #fixing it at PyCharm. #if ipython_completion.startswith('%'): # ipython_completion = ipython_completion[1:] if ipython_completion not in pydev_completions: pydev_completions.add(ipython_completion) inf = ip.object_inspect(ipython_completion) if inf['type_name'] == 'Magic function': pydev_type = TYPE_IPYTHON_MAGIC else: pydev_type = TYPE_IPYTHON pydev_doc = inf['docstring'] if pydev_doc is None: pydev_doc = '' append((ipython_completion, pydev_doc, '', pydev_type)) return ret except: import traceback traceback.print_exc() return []
def getCompletions(self, text, act_tok): # Get completions from IPython and from PyDev and merge the results # IPython only gives context free list of completions, while PyDev # gives detailed information about completions. try: TYPE_IPYTHON = '11' TYPE_IPYTHON_MAGIC = '12' _line, ipython_completions = self.complete(text) from _pydev_bundle._pydev_completer import Completer completer = Completer(self.get_namespace(), None) ret = completer.complete(act_tok) append = ret.append ip = self.ipython pydev_completions = set([f[0] for f in ret]) for ipython_completion in ipython_completions: #PyCharm was not expecting completions with '%'... #Could be fixed in the backend, but it's probably better #fixing it at PyCharm. #if ipython_completion.startswith('%'): # ipython_completion = ipython_completion[1:] if ipython_completion not in pydev_completions: pydev_completions.add(ipython_completion) inf = ip.object_inspect(ipython_completion) if inf['type_name'] == 'Magic function': pydev_type = TYPE_IPYTHON_MAGIC else: pydev_type = TYPE_IPYTHON pydev_doc = inf['docstring'] if pydev_doc is None: pydev_doc = '' append((ipython_completion, pydev_doc, '', pydev_type)) return ret except: import traceback;traceback.print_exc() return []