Extension of the completer class with IPython-specific features
| 1941 | |
| 1942 | |
| 1943 | class IPCompleter(Completer): |
| 1944 | """Extension of the completer class with IPython-specific features""" |
| 1945 | |
| 1946 | @observe('greedy') |
| 1947 | def _greedy_changed(self, change): |
| 1948 | """update the splitter and readline delims when greedy is changed""" |
| 1949 | if change["new"]: |
| 1950 | self.evaluation = "unsafe" |
| 1951 | self.auto_close_dict_keys = True |
| 1952 | self.splitter.delims = GREEDY_DELIMS |
| 1953 | else: |
| 1954 | self.evaluation = "limited" |
| 1955 | self.auto_close_dict_keys = False |
| 1956 | self.splitter.delims = DELIMS |
| 1957 | |
| 1958 | dict_keys_only = Bool( |
| 1959 | False, |
| 1960 | help=""" |
| 1961 | Whether to show dict key matches only. |
| 1962 | |
| 1963 | (disables all matchers except for `IPCompleter.dict_key_matcher`). |
| 1964 | """, |
| 1965 | ) |
| 1966 | |
| 1967 | suppress_competing_matchers = UnionTrait( |
| 1968 | [Bool(allow_none=True), DictTrait(Bool(None, allow_none=True))], |
| 1969 | default_value=None, |
| 1970 | help=""" |
| 1971 | Whether to suppress completions from other *Matchers*. |
| 1972 | |
| 1973 | When set to ``None`` (default) the matchers will attempt to auto-detect |
| 1974 | whether suppression of other matchers is desirable. For example, at |
| 1975 | the beginning of a line followed by `%` we expect a magic completion |
| 1976 | to be the only applicable option, and after ``my_dict['`` we usually |
| 1977 | expect a completion with an existing dictionary key. |
| 1978 | |
| 1979 | If you want to disable this heuristic and see completions from all matchers, |
| 1980 | set ``IPCompleter.suppress_competing_matchers = False``. |
| 1981 | To disable the heuristic for specific matchers provide a dictionary mapping: |
| 1982 | ``IPCompleter.suppress_competing_matchers = {'IPCompleter.dict_key_matcher': False}``. |
| 1983 | |
| 1984 | Set ``IPCompleter.suppress_competing_matchers = True`` to limit |
| 1985 | completions to the set of matchers with the highest priority; |
| 1986 | this is equivalent to ``IPCompleter.merge_completions`` and |
| 1987 | can be beneficial for performance, but will sometimes omit relevant |
| 1988 | candidates from matchers further down the priority list. |
| 1989 | """, |
| 1990 | ).tag(config=True) |
| 1991 | |
| 1992 | merge_completions = Bool( |
| 1993 | True, |
| 1994 | help="""Whether to merge completion results into a single list |
| 1995 | |
| 1996 | If False, only the completion results from the first non-empty |
| 1997 | completer will be returned. |
| 1998 | |
| 1999 | As of version 8.6.0, setting the value to ``False`` is an alias for: |
| 2000 | ``IPCompleter.suppress_competing_matchers = True.``. |
no outgoing calls
no test coverage detected
searching dependent graphs…