Uh oh!
There was an error while loading. Please reload this page.
Make sortText on completions be enum-typed - #36043
Make sortText on completions be enum-typed#36043Ben Lichtman (uniqueiniquity) wants to merge 1 commit into
Conversation
TypeScript Bot (typescript-bot)
commented
Jan 6, 2020
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping Sheetal Nandi (@sheetalkamat), Andrew Casey (@amcasey), Matt Bierner (@mjbvz), Mine Starks (@minestarks) for you. Feel free to loop in other consumers/maintainers if necessary |
| declare namespace ts.Completions { | ||
| export enum SortText { | ||
| LocationPriority = "0", | ||
| OptionalMember = "1", |
There was a problem hiding this comment.
Why are some "member" and others "members"?
Wesley Wigham (weswigham)
commented
Jan 7, 2020
So if VS relies on specific string-numbers for the sort text, does that mean that VS/vscode couldn't handle LS plugins that provide arbitrary alphanumeric content for the |
For reference: The angular language service plugin definitely passes full on arbitrary strings. The |
Wesley Wigham (@weswigham) VS code uses string sorting logic: https://github.com/microsoft/vscode/blob/9f474febfee5330f7a9a7456862ef73d0b6f0bf5/src/vs/editor/contrib/suggest/suggest.ts#L229 So you could use |
Right - all that matters is that whoever is sending the |
Sheetal Nandi (sheetalkamat)
commented
Jan 7, 2020
agree with Wesley Wigham (@weswigham) here.. this needs to be string so that any string value can be passed in.. Its enum in services layer internally so that it can easily be labeled instead of making them "1" or "2" |
Ben Lichtman (uniqueiniquity)
commented
Jan 7, 2020
Wesley Wigham (@weswigham)Sheetal Nandi (@sheetalkamat) we don't generally care about the text - we specifically care about the My goal here is to either prevent these values from being changed or, if that's not feasible, to at least have a way to get notified when they get changed. I'd also be open to an additional property saying "this entry is a js-only guess" if that's preferred. |
Sheetal Nandi (sheetalkamat)
commented
Jan 7, 2020
I think making a property for js-only guess is better than having enum for the sorting text |
Ben Lichtman (uniqueiniquity)
commented
Jan 7, 2020
Superseded by #36063. |
TypeScript Bot (typescript-bot)
commented
Oct 21, 2025
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
We've had a couple issues in the past where the value of a member of the
SortTextenum has changed when adding a new member. This has caused bugs in editors that use TSServer.Here, we ensure that the
sortTextproperty of completion entries is specifically typed with theSortTextenum, so that it's properly represented in the protocol.