(
self,
results: dict[str, MatcherResult],
skip_matchers: set[str],
abort_if_offset_changes: bool,
)
| 3538 | ) |
| 3539 | |
| 3540 | def _arrange_and_extract( |
| 3541 | self, |
| 3542 | results: dict[str, MatcherResult], |
| 3543 | skip_matchers: set[str], |
| 3544 | abort_if_offset_changes: bool, |
| 3545 | ): |
| 3546 | sortable: list[AnyMatcherCompletion] = [] |
| 3547 | ordered: list[AnyMatcherCompletion] = [] |
| 3548 | most_recent_fragment = None |
| 3549 | for identifier, result in results.items(): |
| 3550 | if identifier in skip_matchers: |
| 3551 | continue |
| 3552 | if not result["completions"]: |
| 3553 | continue |
| 3554 | if not most_recent_fragment: |
| 3555 | most_recent_fragment = result["matched_fragment"] |
| 3556 | if ( |
| 3557 | abort_if_offset_changes |
| 3558 | and result["matched_fragment"] != most_recent_fragment |
| 3559 | ): |
| 3560 | break |
| 3561 | if result.get("ordered", False): |
| 3562 | ordered.extend(result["completions"]) |
| 3563 | else: |
| 3564 | sortable.extend(result["completions"]) |
| 3565 | |
| 3566 | if not most_recent_fragment: |
| 3567 | most_recent_fragment = "" # to satisfy typechecker (and just in case) |
| 3568 | |
| 3569 | return most_recent_fragment, [ |
| 3570 | m.text for m in self._deduplicate(ordered + self._sort(sortable)) |
| 3571 | ] |
| 3572 | |
| 3573 | def _complete(self, *, cursor_line, cursor_pos, line_buffer=None, text=None, |
| 3574 | full_text=None) -> _CompleteResult: |
no test coverage detected