File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -518,7 +518,8 @@ def complete(self, tab=False):
518518 return False
519519 else :
520520# remove duplicates and restore order
521- self .matches = sorted (set (matches ))
521+ self .matches = sorted (set (matches ), self .cmp_matches ,
522+ self .key_matches )
522523
523524 if len (self .matches ) == 1 and not OPTS .auto_display_list :
524525 self .list_win_visible = True
@@ -528,6 +529,19 @@ def complete(self, tab=False):
528529 self .matches_iter .update (cw , self .matches )
529530 return True
530531
532+ @staticmethod
533+ def cmp_matches (a , b ):
534+ if a .startswith (('__' , '_' )) and not b .startswith (('__' , '_' )):
535+ return 1
536+ elif b .startswith (('__' , '_' )) and not a .startswith (('__' , '_' )):
537+ return - 1
538+ else :
539+ return cmp (a , b )
540+
541+ @staticmethod
542+ def key_matches (name ):
543+ return name .rsplit ('.' )[- 1 ]
544+
531545 def format_docstring (self , docstring , width , height ):
532546 """Take a string and try to format it into a sane list of strings to be
533547 put into the suggestion box."""
You can’t perform that action at this time.
0 commit comments