Skip to content

Ability to complete partial enum values - #2275

Merged
rolandwalker merged 1 commit into
mainfrom
RW/better-enum-value-completions
Sep 26, 2026
Merged

rolandwalker merged 1 commit into
mainfrom
RW/better-enum-value-completions

Conversation

@rolandwalker

Copy link
Copy Markdown
Contributor

Description

Since the implementation of enum completions, the list of candidates was only presented at the start of the possible enum values. The user could select from the menu of candidates by tab or arrow keys, but not narrow down the list of candidate by typing text. And when a the user had set a positive min_completion_trigger value in ~/.myclirc, no enum value candidates would be offered after reaching the trigger.

With this change, completions are offered on the possible values of an enum similar to other completions, with partially-typed values respected. Candidates are case-ignoring, and completion is case- correcting.

Limitation: can fail when there is a space within the enum value, due to the way word_before_cursor works. This seems like a more general problem, and not a blocker here.

Incidentally add some unrelated tests in test_sqlcompleter.py.

xref #1427

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

Since the implementation of enum completions, the list of candidates
was only presented at the start of the possible enum values.  The user
could select from the menu of candidates by tab or arrow keys, but not
narrow down the list of candidate by typing text. And when a the user
had set a positive min_completion_trigger value in ~/.myclirc, no
enum value candidates would be offered after reaching the trigger.

With this change, completions are offered on the possible values of an
enum similar to other completions, with partially-typed values
respected.  Candidates are case-ignoring, and completion is case-
correcting.

Limitation: can fail when there is a space within the enum value, due
to the way word_before_cursor works.  This seems like a more general
problem, and not a blocker here.

Incidentally add some unrelated tests in test_sqlcompleter.py.
@rolandwalker rolandwalker self-assigned this Sep 26, 2026
@rolandwalker
rolandwalker merged commit cb1f335 into main Sep 26, 2026
12 checks passed
@rolandwalker
rolandwalker deleted the RW/better-enum-value-completions branch September 26, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant