Skip to content

Commit fa6d7f7

Browse files
committed
handle-cli-aliases
1 parent 82657b6 commit fa6d7f7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

IPython/core/completer.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,11 @@ def file_matcher(self, context: CompletionContext) -> SimpleMatcherResult:
22152215
text = context.token
22162216
code_until_cursor = self._extract_code(context.text_until_cursor)
22172217
completion_type = self._determine_completion_context(code_until_cursor)
2218-
if completion_type == self._CompletionContextType.ATTRIBUTE:
2218+
in_cli_context = self._is_completing_in_cli_context(code_until_cursor)
2219+
if (
2220+
completion_type == self._CompletionContextType.ATTRIBUTE
2221+
and not in_cli_context
2222+
):
22192223
return {
22202224
"completions": [],
22212225
"suppress": False,
@@ -2482,21 +2486,16 @@ def magic_color_matcher(self, context: CompletionContext) -> SimpleMatcherResult
24822486

24832487
@context_matcher(identifier="IPCompleter.jedi_matcher")
24842488
def _jedi_matcher(self, context: CompletionContext) -> _JediMatcherResult:
2485-
text = self._extract_code(context.text_until_cursor)
2486-
completion_type = self._determine_completion_context(text)
24872489
matches = self._jedi_matches(
24882490
cursor_column=context.cursor_position,
24892491
cursor_line=context.cursor_line,
24902492
text=context.full_text,
24912493
)
2492-
if completion_type == self._CompletionContextType.ATTRIBUTE:
2493-
suppress = {_get_matcher_id(self.file_matcher)}
2494-
else:
2495-
suppress = False
24962494
return {
24972495
"completions": matches,
2498-
# static analysis should not suppress other matchers except for file matcher
2499-
"suppress": suppress,
2496+
# static analysis should not suppress other matcher
2497+
# NOTE: file_matcher is automatically suppressed on attribute completions
2498+
"suppress": False,
25002499
}
25012500

25022501
def _jedi_matches(
@@ -2798,7 +2797,6 @@ def python_matcher(self, context: CompletionContext) -> SimpleMatcherResult:
27982797
matches = _convert_matcher_v1_result_to_v2(
27992798
matches, type="attribute", fragment=fragment
28002799
)
2801-
matches["suppress"] = {_get_matcher_id(self.file_matcher)}
28022800
return matches
28032801
except NameError:
28042802
# catches <undefined attributes>.<tab>

0 commit comments

Comments
 (0)