Skip to content

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
@andrewbranch andrewbranch marked this pull request as draft December 1, 2021 00:50
@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

Development

Successfully merging this pull request may close these issues.

Auto import sorting path/posix and path/win32 above path Sort import completions by distance from current module

4 participants