Skip to content

Discard function matches that appear after the current cursor in completions #1278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 20, 2025

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Mar 20, 2025

Look, it's not a fancy shiny new feature without a bug 😅

When we discover function matches via tailwindCSS.classFunctions we were implicitly breaking some assumptions used by the completions code:

  • No matches for class attributes or functions that appear after the cursor position are found (we weren't discarding these function matches but we need to)
  • The last match is always the one that corresponds to the current cursor position (we collect function matches separately so the order was wrong)

This PR fixes this by doing two things:

  • Discarding function matches that appear after the current cursor position
  • Sorting the list of attribute and function matches so the last one in the list is always the latest one in the document (up to the cursor)

@thecrypticace thecrypticace merged commit 20890ea into main Mar 20, 2025
@thecrypticace thecrypticace deleted the fix/class-functions-break-completions branch March 20, 2025 22:52
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