Skip to content
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

Completions sorting overhaul #46703

Merged
merged 6 commits into from
Dec 3, 2021
Merged

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Nov 5, 2021

This PR

  • Moves completions sorting from session.ts (where it only affects TS Server, and therefore fourslash server tests but not regular fourslash tests) into the services layer.
  • Respects sortText in the order we produce—previously, we only sorted alphabetically, relying on the editor to do the additional sorting by sortText. This is not necessary for editors, but makes the order we produce in the language service (and therefore in our fourslash tests) identical to what users would see in an editor.
  • Sorts same-named auto-imports by number of directory separators (fixes Auto import sorting path/posix and path/win32 above path #46696 and fixes Sort import completions by distance from current module #41083)
  • Makes an unsorted key for verify.completions, which is like exact but doesn’t care about the order.
  • Updates a bunch of tests accordingly.

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Nov 5, 2021
src/server/session.ts Outdated Show resolved Hide resolved
@andrewbranch andrewbranch marked this pull request as ready for review December 3, 2021 22:04
@andrewbranch andrewbranch changed the title Sort resolved auto-import completions by number of directory separators Completions sorting overhaul Dec 3, 2021
@andrewbranch andrewbranch merged commit 2ce05a8 into microsoft:main Dec 3, 2021
@andrewbranch andrewbranch deleted the bug/46696 branch December 3, 2021 22:54
mprobst pushed a commit to mprobst/TypeScript that referenced this pull request Jan 10, 2022
* Sort resolved auto-import completions by number of directory separators

* Sort completions in services layer

* Finish tests

* Fix more tests

* Respect SortText in completions

* Update tests to use `unsorted` assertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
3 participants