Skip to content
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

Merged
merged 1 commit into from
Dec 9, 2024
Merged

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner December 7, 2024 21:50
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Dec 7, 2024
@CyrusNajmabadi
Copy link
Member Author

@ToddGrun @JoeRobich ptal

text = Keyword("using-static");
return true;
case SyntaxKind.GlobalKeyword when token.Parent is UsingDirectiveSyntax:
text = Keyword("global-using");
Copy link
Member

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.

Copy link
Member Author

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");
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

@Youssef1313 Youssef1313 left a 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.

@CyrusNajmabadi
Copy link
Member Author

@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.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

F1 on global keyword of a global using directive opens the wrong help page
4 participants