-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Add test for F1 on "allows ref struct" #73654
Merged
ToddGrun
merged 1 commit into
dotnet:main
from
ToddGrun:dev/toddgrun/F1HelpForAllowsRefStruct
May 23, 2024
+13
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We should add tests for F1 on
ref
and onstruct
as well. I am not sure if the keys we get for them today are appropriate for the given context. For example, for a regularstruct
constraint we go to page forwhere
(https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/where-generic-type-constraint?devlangs=csharp&f1url=%3FappId%3DDev17IDEF1%26l%3DEN-US%26k%3Dk(structconstraint_CSharpKeyword)%3Bk(SolutionItemsProject)%3Bk(SolutionItemsProject)%3Bk(DevLang-csharp)%26rd%3Dtrue), for astruct
in struct declaration we go to the page for structure types (https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/struct?devlangs=csharp&f1url=%3FappId%3DDev17IDEF1%26l%3DEN-US%26k%3Dk(struct_CSharpKeyword)%3Bk(SolutionItemsProject)%3Bk(SolutionItemsProject)%3Bk(DevLang-csharp)%26rd%3Dtrue). Perhaps for all the three keywords inallows ref struct
we should return the same key that points to a page aboutallows
constraint clause. That could be the page forallows
keyword, I guess.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.
They are most definitely not appropriate, and it looks like that is a general problem for our F1 support (at least that's what I gathered from the bug that all these tests link to)
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.
@ToddGrun
In this case, I think we should open a dedicated issue for the
allows ref struct
constraint. We might want to fix that for this feature even if we don't want to spend time to fix that across the board. BTW, as I mentioned we do treatstruct
keyword specially when it represents astruct
type constraint and that points to the right help page. So, it looks like there is a way to achieve the desired behavior.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.
Can you go ahead and log a bug and we'll have triage decide whether it's worth making these changes? I'm not opposed, I just want to limit the amount of effort I put into F1 support until we validate it's worth the time, given that we've already got a significant amount of debt in this area. Thanks!
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.
@ToddGrun
There are two ways to fix the issue where the same token / keyword has multiple uses.
On the docs side, I've created landing pages for keywords that have multiple uses. Here are examples:
default
in
new
ref
using
Note that the
using
page has examples. Readers new to C# weren't sure whether to pick "using directive" or "using statement". The examples helped disambiguate for them.The
out
keyword is a bit different. It covers the parameter modifier, and links to the generic constraint page.And,
private
,protected
andinternal
cover those modifiers, and link toprivate protected
andprotected internal
as appropriate.Either fix is fine. We do need to keep the pages and the
F1
token used in sync.