Skip to content

Change completions to be sorted in reverse alphabetical order #7

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jun 26, 2025

This PR implements reverse alphabetical sorting for TypeScript completions as requested in the issue.

Changes Made

Modified compareCompletionEntries function in src/services/completions.ts:

  • Changed line 821 from compareStringsCaseSensitiveUI(entryInArray.name, entryToInsert.name)
  • To compareStringsCaseSensitiveUI(entryToInsert.name, entryInArray.name)

This minimal change reverses the name comparison while preserving:

  • Primary sorting by sortText (semantic priority remains intact)
  • Module specifier-based sorting for auto-imports
  • Symbol order fallback logic

Example

Before this change, completions were sorted alphabetically (A-Z):

const obj = { apple: 1, banana: 2, cherry: 3, zebra: 4 };
obj. // Completions: apple, banana, cherry, zebra

After this change, completions are sorted in reverse alphabetical order (Z-A):

const obj = { apple: 1, banana: 2, cherry: 3, zebra: 4 };
obj. // Completions: zebra, cherry, banana, apple

Testing

  • Added focused test case completionReverseAlphabetical.ts to verify the new ordering
  • Updated baseline tests to reflect the new sorting order
  • All existing completion tests continue to pass
  • Code successfully linted and formatted

Fixes #6.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits June 26, 2025 21:06
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
…on sorting

Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Change completions to be sorted in reverse alphabetical order Change completions to be sorted in reverse alphabetical order Jun 26, 2025
@Copilot Copilot AI requested a review from RyanCavanaugh June 26, 2025 21:10
Copilot finished work on behalf of RyanCavanaugh June 26, 2025 21:10
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.

Change completions to be sorted in reverse alphabetical order
2 participants