-
Notifications
You must be signed in to change notification settings - Fork 199
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
Allow string code actions in Razor files #8837
Allow string code actions in Razor files #8837
Conversation
@@ -355,6 +355,15 @@ private static void CleanupSourceMappingStart(FormattingContext context, Range s | |||
return; | |||
} | |||
|
|||
// Parent.Parent.Parent is because the tree is | |||
// ExplicitExpression -> ExplicitExpressionBody -> CSharpCodeBlock -> CSharpExpressionLiteral | |||
if (owner is CSharpExpressionLiteralSyntax { Parent.Parent.Parent: CSharpExplicitExpressionSyntax explicitExpression } && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is required because without code actions, there was no real way to invoke ontype formatting in an explicit expression, so there was just no code to deal with them.
if (collapsedEdit.NewText.Length == 0 && | ||
collapsedEdit.Range.Start.Line == collapsedEdit.Range.End.Line && | ||
collapsedEdit.Range.Start.Character == collapsedEdit.Range.End.Character) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is required because otherwise the edit to remove the @
on @"goo"
was being dropped. I've honestly no idea why we would have been filtering out empty edits, and can only guess that the intent was to filter out useless edits. No existing formatting tests break with this change, so we've got that going for us at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Glad to see more code actions
Fixes: An inate desire to have more code actions