Skip to content

Conversation

ToddGrun
Copy link
Contributor

Better handle attribute snippet completion in components

This addresses a scenario where completion commit would insert an extra '=' inside the attribute value. For example, committing "@​ref" via typing '=' in this code

<p @re />

below would end up with the following document contents:

<p @ref="=" />

Fixes: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2581843

2) Break apart snippet context detection
3) Make local functions static
2) Add a couple statics for common IA collections
… to when creating a commit character for "="

2) Have the AddCompletion method return a RazorCommitCharacter instead of a string, to indicate whether the commit should insert the commit character
3) Add a couple more statics that are commonly used.
4) Add test
@ToddGrun ToddGrun requested a review from a team as a code owner September 29, 2025 23:11
@ToddGrun ToddGrun changed the title Dev/toddgrun/extra equals inserted in completion Better handle attribute snippet completion in components Sep 29, 2025
@ToddGrun
Copy link
Contributor Author

ToddGrun commented Oct 1, 2025

@dotnet/razor-tooling ptal

Copy link
Member

@chsienki chsienki left a comment

Choose a reason for hiding this comment

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

LGTM, but may want to wait for @davidwengier to take a look too

Copy link
Member

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

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

It would be really good if you could do a quick test of this and #12271 in VS Code to make sure nothing regresses there. Feels like this area of completion keeps changing, and I wonder if we're accidentally yo-yo-ing between working in VS, and VS Code, and fixing for one breaks the other. Or we just have lots of little bugs. I'd believe either one tbh

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.

3 participants