Beispiel #1
0
    def doIt(self, dbg):
        """ Converts request into completions """
        try:
            remove_path = None
            try:

                frame = pydevd_vars.findFrame(self.thread_id, self.frame_id)
                if frame is not None:

                    msg = _pydev_completer.GenerateCompletionsAsXML(
                        frame, self.act_tok)

                    cmd = dbg.cmdFactory.makeGetCompletionsMessage(
                        self.sequence, msg)
                    dbg.writer.addCommand(cmd)
                else:
                    cmd = dbg.cmdFactory.makeErrorMessage(
                        self.sequence,
                        "InternalGetCompletions: Frame not found: %s from thread: %s"
                        % (self.frame_id, self.thread_id))
                    dbg.writer.addCommand(cmd)

            finally:
                if remove_path is not None:
                    sys.path.remove(remove_path)

        except:
            exc = GetExceptionTracebackStr()
            sys.stderr.write('%s\n' % (exc, ))
            cmd = dbg.cmdFactory.makeErrorMessage(
                self.sequence, "Error evaluating expression " + exc)
            dbg.writer.addCommand(cmd)
def get_completions(frame, act_tok):
    """ fetch all completions, create xml for the same
    return the completions xml
    """
    return _pydev_completer.GenerateCompletionsAsXML(frame, act_tok)