| 363 | |
| 364 | |
| 365 | def _emit_binary_or_comma(ctx: SuggestContext) -> list[Suggestion]: |
| 366 | original_text = ctx.text_before_cursor |
| 367 | prev_keyword, rewound_text = find_prev_keyword(ctx.text_before_cursor) |
| 368 | enum_suggestion = _enum_value_suggestion(original_text, ctx.full_text) |
| 369 | |
| 370 | # guard against non-progressing parser rewinds, which can otherwise |
| 371 | # recurse forever on some operator shapes. |
| 372 | if prev_keyword and rewound_text.rstrip() != original_text.rstrip(): |
| 373 | fallback = suggest_based_on_last_token(prev_keyword, rewound_text, None, ctx.full_text, ctx.identifier) |
| 374 | else: |
| 375 | # perhaps this fallback should include columns |
| 376 | fallback = _keyword_suggestions() |
| 377 | |
| 378 | if enum_suggestion and _is_where_or_having(prev_keyword): |
| 379 | return [enum_suggestion] + fallback |
| 380 | return fallback |
| 381 | |
| 382 | |
| 383 | def _word_starts_with_digit_or_dot(ctx: SuggestContext) -> bool: |