shell autocompleter takes the right global variables into account now debugger fine grinding

Thu, 23 Mar 2017 20:27:21 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Thu, 23 Mar 2017 20:27:21 +0100
branch
debugger fine grinding
changeset 5657
0f4257c1abcb
parent 5656
9c21b2746218
child 5658
e5f6fe5855fd

shell autocompleter takes the right global variables into account now

DebugClients/Python/DebugClientBase.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
--- 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),
--- a/changelog	Thu Mar 23 19:06:13 2017 +0100
+++ b/changelog	Thu Mar 23 20:27:21 2017 +0100
@@ -7,6 +7,8 @@
      and generators to the code style checker
   -- added capability to place line flags (e.g. __IGNORE...) on the line
      following the one to be ignored
+- Debugger
+  -- shell autocompleter takes the right global variables into account now
 - Mercurial Interface
   -- extended the user configuration dialog
 

eric ide

mercurial