-
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 f1 item for global usings #76327
Conversation
@ToddGrun @JoeRobich ptal |
text = Keyword("using-static"); | ||
return true; | ||
case SyntaxKind.GlobalKeyword when token.Parent is UsingDirectiveSyntax: | ||
text = Keyword("global-using"); |
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 needs a corresponding PR on dotnet/docs I think.
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.
yes. that will come after this.
: Keyword("using"); | ||
return true; | ||
case SyntaxKind.StaticKeyword when token.Parent is UsingDirectiveSyntax: | ||
text = Keyword("using-static"); |
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.
While this is existing code for years, this doesn't actually work and needs a change in dotnet/docs
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.
there is an issuue on .net docs on this already.
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.
My general feeling, F1 is going into a hard-to-maintain state by having to special case the "context" of each keyword.
I feel like there should be a generic doc page for global
keyword that explains all possible contexts of the keyword. And then Roslyn doesn't need to special case global
(as alias) vs global
(in global using) etc. It just redirects to the same page for both, and that page has a brief summary with a link to the long doc page for each.
The same goes for every single keyword where there is too much of special casing here.
This is definitely not something to address for this PR, but wanted to comment my feelings for F1 :)
Note that my suggestion above, if you decided to go with it, will require coordination with dotnet/docs team.
I'm starting to think more about this as a docs issue. There is already this doc page with links to all keywords:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/
I find that this may be confusing to beginners. If you open global
from that page, it redirects to page about ::
(https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/namespace-alias-qualifier).
To me, it should redirect to a page that has links to both ::
and global using
.
Then, for any global
, Roslyn just redirects to the same page without any special casing.
cc @BillWagner as well for thoughts on organizing the docs that way.
@Youssef1313 i think this is complimentary. Docs can update how they want, and we can provide the right context for it to take the user to the best location. Worst case is that roslyn provides more contxt, while docs just redirects to one common location. |
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.
Fixes dotnet/docs#43915