##// END OF EJS Templates
Initial messing around....
Brian E. Granger -
Show More
@@ -1,3 +1,4 b''
1 # encoding: utf-8
1 """Word completion for IPython.
2 """Word completion for IPython.
2
3
3 This module is a fork of the rlcompleter module in the Python standard
4 This module is a fork of the rlcompleter module in the Python standard
@@ -594,12 +595,14 b' class IPCompleter(Completer):'
594 #= re.compile(r'[\s|\[]*(\w+)(?:\s*=?\s*.*)')
595 #= re.compile(r'[\s|\[]*(\w+)(?:\s*=?\s*.*)')
595
596
596 # All active matcher routines for completion
597 # All active matcher routines for completion
597 self.matchers = [self.python_matches,
598 self.matchers = [
598 self.file_matches,
599 self.python_matches,
599 self.magic_matches,
600 self.file_matches,
600 self.python_func_kw_matches,
601 self.magic_matches,
601 self.dict_key_matches,
602 self.python_func_kw_matches,
602 ]
603 self.dict_key_matches,
604 self.latex_matches
605 ]
603
606
604 def all_completions(self, text):
607 def all_completions(self, text):
605 """
608 """
@@ -966,6 +969,12 b' class IPCompleter(Completer):'
966
969
967 return [leading + k + suf for k in matches]
970 return [leading + k + suf for k in matches]
968
971
972 def latex_matches(self, text):
973 if text.startswith('\\foo'):
974 return ['foo']
975 else:
976 return []
977
969 def dispatch_custom_completer(self, text):
978 def dispatch_custom_completer(self, text):
970 #io.rprint("Custom! '%s' %s" % (text, self.custom_completers)) # dbg
979 #io.rprint("Custom! '%s' %s" % (text, self.custom_completers)) # dbg
971 line = self.line_buffer
980 line = self.line_buffer
@@ -1039,7 +1048,7 b' class IPCompleter(Completer):'
1039 matches : list
1048 matches : list
1040 A list of completion matches.
1049 A list of completion matches.
1041 """
1050 """
1042 #io.rprint('\nCOMP1 %r %r %r' % (text, line_buffer, cursor_pos)) # dbg
1051 io.rprint('\nCOMP1 %r %r %r' % (text, line_buffer, cursor_pos)) # dbg
1043
1052
1044 # if the cursor position isn't given, the only sane assumption we can
1053 # if the cursor position isn't given, the only sane assumption we can
1045 # make is that it's at the end of the line (the common case)
1054 # make is that it's at the end of the line (the common case)
@@ -1056,7 +1065,7 b' class IPCompleter(Completer):'
1056
1065
1057 self.line_buffer = line_buffer
1066 self.line_buffer = line_buffer
1058 self.text_until_cursor = self.line_buffer[:cursor_pos]
1067 self.text_until_cursor = self.line_buffer[:cursor_pos]
1059 #io.rprint('COMP2 %r %r %r' % (text, line_buffer, cursor_pos)) # dbg
1068 io.rprint('COMP2 %r %r %r' % (text, line_buffer, cursor_pos)) # dbg
1060
1069
1061 # Start with a clean slate of completions
1070 # Start with a clean slate of completions
1062 self.matches[:] = []
1071 self.matches[:] = []
@@ -1,3 +1,4 b''
1 # encoding: utf-8
1 """Implementations for various useful completers.
2 """Implementations for various useful completers.
2
3
3 These are all loaded by default by IPython.
4 These are all loaded by default by IPython.
@@ -165,6 +165,7 b' define(['
165 Completer.prototype.finish_completing = function (msg) {
165 Completer.prototype.finish_completing = function (msg) {
166 // let's build a function that wrap all that stuff into what is needed
166 // let's build a function that wrap all that stuff into what is needed
167 // for the new completer:
167 // for the new completer:
168 console.log(msg);
168 var content = msg.content;
169 var content = msg.content;
169 var start = content.cursor_start;
170 var start = content.cursor_start;
170 var end = content.cursor_end;
171 var end = content.cursor_end;
General Comments 0
You need to be logged in to leave comments. Login now