##// END OF EJS Templates
Typing '%' restrict autocompletion to magics
ygeyzel -
Show More
@@ -2139,8 +2139,9 b' class IPCompleter(Completer):'
2139 # different types of objects. The rlcomplete() method could then
2139 # different types of objects. The rlcomplete() method could then
2140 # simply collapse the dict into a list for readline, but we'd have
2140 # simply collapse the dict into a list for readline, but we'd have
2141 # richer completion semantics in other environments.
2141 # richer completion semantics in other environments.
2142 completions:Iterable[Any] = []
2142 is_magic_prefix = len(text) > 0 and text[0] == "%"
2143 if self.use_jedi:
2143 completions: Iterable[Any] = []
2144 if self.use_jedi and not is_magic_prefix:
2144 if not full_text:
2145 if not full_text:
2145 full_text = line_buffer
2146 full_text = line_buffer
2146 completions = self._jedi_matches(
2147 completions = self._jedi_matches(
@@ -1262,3 +1262,14 b' class TestCompleter(unittest.TestCase):'
1262 _, matches = ip.complete(None, "test.meth(")
1262 _, matches = ip.complete(None, "test.meth(")
1263 self.assertIn("meth_arg1=", matches)
1263 self.assertIn("meth_arg1=", matches)
1264 self.assertNotIn("meth2_arg1=", matches)
1264 self.assertNotIn("meth2_arg1=", matches)
1265
1266 def test_percent_symbol_restrict_to_magic_completions(self):
1267 ip = get_ipython()
1268 completer = ip.Completer
1269 text = "%a"
1270
1271 with provisionalcompleter():
1272 completer.use_jedi = True
1273 completions = completer.completions(text, len(text))
1274 for c in completions:
1275 self.assertEqual(c.text[0], "%")
General Comments 0
You need to be logged in to leave comments. Login now