@@ -2209,15 +2209,6 @@ def file_matcher(self, context: CompletionContext) -> SimpleMatcherResult:
22092209 """
22102210 # TODO: add a heuristic for suppressing (e.g. if it has OS-specific delimiter,
22112211 # starts with `/home/`, `C:\`, etc)
2212- last_line = context .full_text .split ("\n " )[- 1 ]
2213- text_before_token = last_line [: last_line .rfind (context .token )]
2214-
2215- # Suppress path completion when completing methods/attributes
2216- if text_before_token .endswith ((")" , "]" )):
2217- return {
2218- "completions" : [],
2219- "suppress" : True ,
2220- }
22212212
22222213 text = context .token
22232214
@@ -2490,7 +2481,7 @@ def _jedi_matcher(self, context: CompletionContext) -> _JediMatcherResult:
24902481 return {
24912482 "completions" : matches ,
24922483 # static analysis should not suppress other matchers
2493- "suppress" : False ,
2484+ "suppress" : { _get_matcher_id ( self . file_matcher )} ,
24942485 }
24952486
24962487 def _jedi_matches (
@@ -2750,12 +2741,16 @@ def python_matcher(self, context: CompletionContext) -> SimpleMatcherResult:
27502741 is None
27512742 )
27522743 matches = filter (no__name , matches )
2753- return _convert_matcher_v1_result_to_v2 (
2744+ matches = _convert_matcher_v1_result_to_v2 (
27542745 matches , type = "attribute" , fragment = fragment
27552746 )
2747+ matches ["suppress" ] = {_get_matcher_id (self .file_matcher )}
2748+ return matches
27562749 except NameError :
27572750 # catches <undefined attributes>.<tab>
2758- return SimpleMatcherResult (completions = [], suppress = False )
2751+ return SimpleMatcherResult (
2752+ completions = [], suppress = {_get_matcher_id (self .file_matcher )}
2753+ )
27592754 else :
27602755 try :
27612756 matches = self .global_matches (context .token , context = context )
@@ -2766,7 +2761,7 @@ def python_matcher(self, context: CompletionContext) -> SimpleMatcherResult:
27662761 completions = [
27672762 SimpleCompletion (text = match , type = "variable" ) for match in matches
27682763 ],
2769- suppress = False ,
2764+ suppress = { _get_matcher_id ( self . file_matcher )} ,
27702765 )
27712766
27722767 @completion_matcher (api_version = 1 )
0 commit comments