Skip to content

Conversation

@ToddGrun
Copy link
Contributor

This makes razor C# completions sort much more similarly to how C# completions sort in .cs files. (Note that we still have the nuint/null selection issue, that is covered by dotnet/razor#12483 which is how I found this issue)

*** .cs behavior ***
image

*** old razor behavior ***
image

*** new razor behavior ***
image

… makes razor C# completions sort much more similarly to how C# completions sort in .cs files.
@ToddGrun ToddGrun requested a review from a team as a code owner January 23, 2026 23:31
}
// Add sort text to ensure that items are sorted by their position in the list.
// The max length of the list is 1000 items, so we only need 4 characters to represent the index.
lspItem.SortText = index.ToString("D4");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will probably have an impact on the completion list size. Also - is there any impact of not having the sort text appended at the end? I guess it should work, but if there are items coming from other completion sources they may not sort correctly against these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will probably have an impact on the completion list size.

Yep, although it should be relatively small as the value is limited to 4 chars.

is there any impact of not having the sort text appended at the end?

I don't think so. The sorting will be completely determined by the 4 character string that is generated from the index passed into this method (and we don't get sent in the same index more than once)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants