##// END OF EJS Templates
Greedy completer for qtconsole....
macgyver -
Show More
@@ -228,7 +228,8 b' class CompletionSplitter(object):'
228
228
229 # A string of delimiter characters. The default value makes sense for
229 # A string of delimiter characters. The default value makes sense for
230 # IPython's most typical usage patterns.
230 # IPython's most typical usage patterns.
231 _delims = ' \t\n`!@#$^&*()=+[{]}\\|;:\'",<>?'
231 #_delims = ' \t\n`!@#$^&*()=+[{]}\\|;:\'",<>?'
232 _delims = ' \n\t'
232
233
233 # The expression (a normal string) to be compiled into a regular expression
234 # The expression (a normal string) to be compiled into a regular expression
234 # for actual splitting. We store it as an attribute mostly for ease of
235 # for actual splitting. We store it as an attribute mostly for ease of
@@ -349,14 +350,18 b' class Completer(object):'
349
350
350 """
351 """
351
352
352 #print 'Completer->attr_matches, txt=%r' % text # dbg
353 #io.rprint('Completer->attr_matches, txt=%r' % text) # dbg
353 # Another option, seems to work great. Catches things like ''.<tab>
354 # Another option, seems to work great. Catches things like ''.<tab>
354 m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)
355 m = re.match(r"(\S+(\.\w+)*)\.(\w*)$", text)
355
356
356 if not m:
357 if m:
357 return []
358 expr, attr = m.group(1, 3)
358
359 else:
359 expr, attr = m.group(1, 3)
360 m2 = re.match(r"(.+)\.(\w*)$", self.line_buffer)
361 if not m2:
362 return []
363 expr, attr = m2.group(1,2)
364
360 try:
365 try:
361 obj = eval(expr, self.namespace)
366 obj = eval(expr, self.namespace)
362 except:
367 except:
@@ -579,7 +584,7 b' class IPCompleter(Completer):'
579 def python_matches(self,text):
584 def python_matches(self,text):
580 """Match attributes or global python names"""
585 """Match attributes or global python names"""
581
586
582 #print 'Completer->python_matches, txt=%r' % text # dbg
587 #io.rprint('Completer->python_matches, txt=%r' % text) # dbg
583 if "." in text:
588 if "." in text:
584 try:
589 try:
585 matches = self.attr_matches(text)
590 matches = self.attr_matches(text)
@@ -680,7 +685,7 b' class IPCompleter(Completer):'
680 return argMatches
685 return argMatches
681
686
682 def dispatch_custom_completer(self, text):
687 def dispatch_custom_completer(self, text):
683 #print "Custom! '%s' %s" % (text, self.custom_completers) # dbg
688 #io.rprint("Custom! '%s' %s" % (text, self.custom_completers)) # dbg
684 line = self.line_buffer
689 line = self.line_buffer
685 if not line.strip():
690 if not line.strip():
686 return None
691 return None
General Comments 0
You need to be logged in to leave comments. Login now