Skip to content

Handle more cases in F1 help service#60156

Merged
davidwengier merged 11 commits intodotnet:mainfrom
Youssef1313:60154-generics-f1
Mar 16, 2022
Merged

Handle more cases in F1 help service#60156
davidwengier merged 11 commits intodotnet:mainfrom
Youssef1313:60154-generics-f1

Conversation

@Youssef1313
Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 commented Mar 14, 2022

@Youssef1313 Youssef1313 requested a review from a team as a code owner March 14, 2022 06:53
@ghost ghost added Community The pull request was submitted by a contributor who is not a Microsoft employee. Area-IDE labels Mar 14, 2022

if (token.IsKind(SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken) && token.Parent.IsKind(SyntaxKind.TypeParameterList, SyntaxKind.TypeArgumentList))
{
text = Keyword("generics");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm using the Keyword call for consistency, but let me know if I shouldn't use it in this case.

@Youssef1313 Youssef1313 changed the title Handle '<' and '>' tokens in generic context for F1 service Handle more cases in F1 keyword service Mar 14, 2022
@Youssef1313 Youssef1313 changed the title Handle more cases in F1 keyword service Handle more cases in F1 help service Mar 14, 2022
Copy link
Copy Markdown
Member Author

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

@RikkiGibson FYI we will need to handle !!. But it's waiting on dotnet/docs#28443. Do you want a tracking issue for this?

return true;
}

if (token.IsKind(SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken) && token.Parent.IsKind(SyntaxKind.TypeParameterList, SyntaxKind.TypeArgumentList))
Copy link
Copy Markdown
Member Author

@Youssef1313 Youssef1313 Mar 14, 2022

Choose a reason for hiding this comment

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

Note to self:

TODO:

< and > in:

  • FunctionPointerParameterListSyntax
  • RelationalPatternSyntax
  • XML doc comments (OperatorMemberCrefSyntax, XmlElementStartTagSyntax, XmlEmptyElementSyntax)

@davidwengier @CyrusNajmabadi Is it worth handling < and > in XML doc comments?


var result = TryGetText(token, semanticModel, document, cancellationToken);
if (string.IsNullOrEmpty(result))
if (result is null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why this cahnge?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@CyrusNajmabadi I changed the path that returns string.Empty to return null instead. Just simplifies the check and allows me to use ?? below. We're also now more consistent. Previously we were returning null in some cases, and string.Empty in other cases. Both had the same meaning of "we don't have an F1 keyword".


return result;
// This redirects to https://docs.microsoft.com/visualstudio/ide/not-in-toc/default, indicating nothing is found.
return result ?? "vs.texteditor";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you make a constant for this at the top of the file and doc that?

Comment on lines +295 to +296
// PROTOTYPE: Figure out where to redirect.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@BillWagner @333fred Is there a documentation page we can redirect to here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not yet. I'll ping you and @RikkiGibson on the docs issue referenced below when I open that PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@BillWagner Sorry for not clarifying. This was about function pointers

if (token.IsKind(SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken))
{
if (token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList))
{
// PROTOTYPE: Figure out where to redirect.

I found now that https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/unsafe-code is the most suitable page.

Opened dotnet/docs#28669.

@RikkiGibson
Copy link
Copy Markdown
Member

@RikkiGibson FYI we will need to handle !!. But it's waiting on dotnet/docs#28443. Do you want a tracking issue for this?

No thanks, I'll just subscribe to the docs issue.

@davidwengier davidwengier enabled auto-merge (squash) March 16, 2022 00:13
@davidwengier davidwengier merged commit 8e31456 into dotnet:main Mar 16, 2022
@ghost ghost added this to the Next milestone Mar 16, 2022
@Youssef1313 Youssef1313 deleted the 60154-generics-f1 branch March 16, 2022 02:33
@allisonchou allisonchou modified the milestones: Next, 17.2.P3 Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

7 participants