diff -r 9c21b2746218 -r 0f4257c1abcb DebugClients/Python/DebugClientBase.py --- a/DebugClients/Python/DebugClientBase.py Thu Mar 23 19:06:13 2017 +0100 +++ b/DebugClients/Python/DebugClientBase.py Thu Mar 23 20:27:21 2017 +0100 @@ -223,9 +223,6 @@ self.variant = 'You should not see this' - # commandline completion stuff - self.complete = Completer(self.debugMod.__dict__).complete - self.compile_command = codeop.CommandCompiler() self.coding_re = re.compile(r"coding[:=]\s*([-\w_.]+)") @@ -1778,7 +1775,20 @@ self.__getCompletionList(text, localCompleter, completions) except AttributeError: pass - self.__getCompletionList(text, self.complete, completions) + + cf = self.currentThread.getCurrentFrame() + frmnr = self.framenr + while cf is not None and frmnr > 0: + cf = cf.f_back + frmnr -= 1 + + if cf is None: + globaldict = self.debugMod.__dict__ + else: + globaldict = cf.f_globals + + globalCompleter = Completer(globaldict).complete + self.__getCompletionList(text, globalCompleter, completions) self.sendJsonCommand("ResponseCompletion", { "completions": list(completions),