Perform completion without considering line contents or cursor position. Strings are matched directly while CompletionItems are matched against their 'text' member. :param text: the string prefix we are attempting to match (all matches must begin with it) :param line: the c
(
self,
text: str,
line: str, # noqa: ARG002
begidx: int, # noqa: ARG002
endidx: int, # noqa: ARG002
match_against: Iterable[str | CompletionItem],
*,
sort: bool = True,
)
| 2027 | return tokens, raw_tokens |
| 2028 | |
| 2029 | def basic_complete( |
| 2030 | self, |
| 2031 | text: str, |
| 2032 | line: str, # noqa: ARG002 |
| 2033 | begidx: int, # noqa: ARG002 |
| 2034 | endidx: int, # noqa: ARG002 |
| 2035 | match_against: Iterable[str | CompletionItem], |
| 2036 | *, |
| 2037 | sort: bool = True, |
| 2038 | ) -> Completions: |
| 2039 | """Perform completion without considering line contents or cursor position. |
| 2040 | |
| 2041 | Strings are matched directly while CompletionItems are matched against their 'text' member. |
| 2042 | |
| 2043 | :param text: the string prefix we are attempting to match (all matches must begin with it) |
| 2044 | :param line: the current input line with leading whitespace removed |
| 2045 | :param begidx: the beginning index of the prefix text |
| 2046 | :param endidx: the ending index of the prefix text |
| 2047 | :param match_against: the items being matched against |
| 2048 | :param sort: if True, then results will be sorted. If False, then items will |
| 2049 | be in the same order they appeared in match_against. |
| 2050 | :return: a Completions object |
| 2051 | """ |
| 2052 | matches: list[CompletionItem] = [] |
| 2053 | |
| 2054 | for item in match_against: |
| 2055 | candidate = item.text if isinstance(item, CompletionItem) else item |
| 2056 | if candidate.startswith(text): |
| 2057 | matches.append(item if isinstance(item, CompletionItem) else CompletionItem(item)) |
| 2058 | |
| 2059 | return Completions(items=matches, is_sorted=not sort) |
| 2060 | |
| 2061 | def delimiter_complete( |
| 2062 | self, |