Skip to content

Add autocomplete suggestions for previously checked list items - #1087

Open
Ruj89 wants to merge 1 commit into
Crustack:mainfrom
Ruj89:main
Open

Add autocomplete suggestions for previously checked list items#1087
Ruj89 wants to merge 1 commit into
Crustack:mainfrom
Ruj89:main

Conversation

@Ruj89

@Ruj89 Ruj89 commented Aug 5, 2026

Copy link
Copy Markdown

This PR introduces autocomplete for checked checklist items, making recurring lists faster and easier to reuse.

When the user starts typing a new item, NotallyX now searches previously checked entries and displays up to two matching suggestions. Matching is case-insensitive, starts after two characters, and only considers items whose text begins with the entered query.

Selecting a suggestion:

  • replaces the current item's text with the previously checked entry;
  • restores it as an unchecked item;
  • removes the old checked entry to prevent duplicates;
  • preserves the correct list order and parent/child relationships;
  • keeps the entire operation atomic, allowing it to be reverted with a single undo action.

The implementation supports both standard lists and lists using automatic sorting by checked status. The suggestion popup is also dismissed appropriately when the item loses focus or its ViewHolder is rebound.

Summary by CodeRabbit

  • New Features
    • Added autocomplete suggestions for previously completed list items while editing.
    • Suggestions support case-insensitive matching, require at least two characters, and exclude duplicates and the current item.
    • Selecting a suggestion replaces the current text, restores it to an active state, and removes the completed item and its children.
    • Changes preserve list ordering, hierarchy, item counts, and undo support.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 903b3d5f-9d55-473e-8ea1-a052702351d0

📥 Commits

Reviewing files that changed from the base of the PR and between 1fbbdb5 and 569a2e3.

📒 Files selected for processing (4)
  • app/src/main/java/com/philkes/notallyx/presentation/view/note/listitem/ListManager.kt
  • app/src/main/java/com/philkes/notallyx/presentation/view/note/listitem/adapter/ListItemVH.kt
  • app/src/test/kotlin/com/philkes/notallyx/presentation/view/note/listitem/CheckedItemAutocompleteTest.kt
  • app/src/test/kotlin/com/philkes/notallyx/recyclerview/listmanager/ListManagerCheckedTest.kt

📝 Walkthrough

Walkthrough

Changes

Checked-item autocomplete

Layer / File(s) Summary
Checked-item matching and suggestion contracts
app/src/main/java/com/philkes/notallyx/presentation/view/note/listitem/ListManager.kt, app/src/test/kotlin/com/philkes/notallyx/presentation/view/note/listitem/CheckedItemAutocompleteTest.kt
The manager adds CheckedItemSuggestion and matches checked items by case-insensitive prefix. Blank input, short queries, duplicates, and the current item are excluded.
Autocomplete completion state updates
app/src/main/java/com/philkes/notallyx/presentation/view/note/listitem/ListManager.kt, app/src/test/kotlin/com/philkes/notallyx/recyclerview/listmanager/ListManagerCheckedTest.kt
Completion replaces and unchecks the current item, removes the selected checked item and its children, recalculates ordering, records a batch change, and restores focus. Tests cover sorting, hierarchy, ordering, and undo behavior.
Editor suggestion popup integration
app/src/main/java/com/philkes/notallyx/presentation/view/note/listitem/adapter/ListItemVH.kt
The view holder displays matching suggestions while editing, handles selection and multiline paste, and dismisses the popup when binding changes or focus is lost.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Editor
  participant ListItemVH
  participant ListManager
  participant ListState
  Editor->>ListItemVH: type item text
  ListItemVH->>ListManager: request checked-item suggestions
  ListManager-->>ListItemVH: return up to two matches
  ListItemVH-->>Editor: display suggestion popup
  Editor->>ListItemVH: select suggestion
  ListItemVH->>ListManager: complete selected checked item
  ListManager->>ListState: replace current item and remove selected subtree
  ListState-->>ListManager: return updated state and focus position
  ListManager-->>ListItemVH: apply batch change and update counts
Loading

Suggested reviewers: crustack

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: autocomplete suggestions for previously checked list items.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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