-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix managed/unmanaged keyword completion after typing in function pointer contexts #81017
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
Changes from 2 commits
b1dc739
d6ffa57
a9e5e87
9d15ef6
814cbe5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3070,8 +3070,18 @@ public static bool IsEnumTypeMemberAccessContext(this SyntaxTree syntaxTree, Sem | |
|
|
||
| public static bool IsFunctionPointerCallingConventionContext(this SyntaxTree syntaxTree, SyntaxToken targetToken) | ||
| { | ||
| return targetToken.IsKind(SyntaxKind.AsteriskToken) && | ||
| targetToken.Parent is FunctionPointerTypeSyntax functionPointerType && | ||
| targetToken == functionPointerType.AsteriskToken; | ||
| // Check if we're at or after delegate* | ||
|
||
| if (targetToken.IsKind(SyntaxKind.AsteriskToken) && | ||
| targetToken.Parent is FunctionPointerTypeSyntax functionPointerType && | ||
| targetToken == functionPointerType.AsteriskToken) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| // Check if the previous token is the asterisk (handles typing after delegate*) | ||
| var previousToken = targetToken.GetPreviousToken(); | ||
| return previousToken.IsKind(SyntaxKind.AsteriskToken) && | ||
| previousToken.Parent is FunctionPointerTypeSyntax functionPointerType2 && | ||
| previousToken == functionPointerType2.AsteriskToken; | ||
| } | ||
| } | ||
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.
@copilot use
[Fact, WorkItem("...")]. Also, test the specific case i n the original bug, where the function pointer type was being written inside a cast.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.
Done in a9e5e87. Added WorkItem attribute and test for the cast expression case from the original bug report.