##// END OF EJS Templates
Make completer recognize escaped quotes in strings.
Jez Ng -
Show More
@@ -692,10 +692,10 b' class IPCompleter(Completer):'
692 try: regexp = self.__funcParamsRegex
692 try: regexp = self.__funcParamsRegex
693 except AttributeError:
693 except AttributeError:
694 regexp = self.__funcParamsRegex = re.compile(r'''
694 regexp = self.__funcParamsRegex = re.compile(r'''
695 '.*?' | # single quoted strings or
695 '.*?(?<!\\)' | # single quoted strings or
696 ".*?" | # double quoted strings or
696 ".*?(?<!\\)" | # double quoted strings or
697 \w+ | # identifier
697 \w+ | # identifier
698 \S # other characters
698 \S # other characters
699 ''', re.VERBOSE | re.DOTALL)
699 ''', re.VERBOSE | re.DOTALL)
700 # 1. find the nearest identifier that comes before an unclosed
700 # 1. find the nearest identifier that comes before an unclosed
701 # parenthesis before the cursor
701 # parenthesis before the cursor
@@ -290,6 +290,8 b' def test_func_kw_completions():'
290 # Simulate completing with cursor right after b (pos==10):
290 # Simulate completing with cursor right after b (pos==10):
291 s, matches = c.complete(None,'myfunc(1,b)', 10)
291 s, matches = c.complete(None,'myfunc(1,b)', 10)
292 nt.assert_in('b=', matches)
292 nt.assert_in('b=', matches)
293 s, matches = c.complete(None,'myfunc(a="escaped\\")string",b')
294 nt.assert_in('b=', matches)
293
295
294
296
295 def test_line_magics():
297 def test_line_magics():
General Comments 0
You need to be logged in to leave comments. Login now