Fix F1 keyword for interpolated and verbatim strings#46987
Fix F1 keyword for interpolated and verbatim strings#46987CyrusNajmabadi merged 12 commits intodotnet:masterfrom
Conversation
| if (token.IsKind(SyntaxKind.InterpolatedStringStartToken) || | ||
| token.IsKind(SyntaxKind.InterpolatedStringEndToken) || | ||
| token.IsKind(SyntaxKind.InterpolatedStringTextToken)) | ||
| { | ||
| text = "$_CSharpKeyword"; | ||
| return true; | ||
| } | ||
|
|
||
| if (token.IsKind(SyntaxKind.StringLiteralToken) && token.ValueText[0] == '@') | ||
| { | ||
| text = "@_CSharpKeyword"; | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Currently, the dotnet/docs doesn't have any @$_CSharpKeyword F1 keyword. I opened a PR (dotnet/docs#20197) to add this in docs. Are you okay with this new F1 keyword and adding the following here?
if (token.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken))
{
text = "@$_CSharpKeyword";
return true;
}There was a problem hiding this comment.
Looks like that would regress the experience from a help page (albeit for string, which isn't great) to a generic 404 page, so I'd say leave it until after the doc page is created.
There was a problem hiding this comment.
@davidwengier I've a PR there
dotnet/docs#20197, so if you agree for the combination@$, we can wait for this PR until the docs one is merged.
This test failed unintentionally with my changes. But actually the new behavior is what makes sense. The result should be |
| token.IsKind(SyntaxKind.InterpolatedStringTextToken)) | ||
| { | ||
| text = "::_CSharpKeyword"; | ||
| text = "$_CSharpKeyword"; |
There was a problem hiding this comment.
can you provide the links these now go to.
There was a problem hiding this comment.
The $_CSharpKeyword should go to this:
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
There was a problem hiding this comment.
and is that where $_CSharpKeyword does redirect to? Can you give me the links these produce directly, so i can validate they end up landing on an appropriate page? Thanks!
There was a problem hiding this comment.
There was a problem hiding this comment.
That link takes me to https://docs.microsoft.com/en-us/.
There was a problem hiding this comment.
Also, adding @davidwengier as he touched this area before (dotnet/docs#19700 (comment))
There was a problem hiding this comment.
It actually redirects to "/Areas/Epx/Content/500.aspx?aspxerrorpath=/query/dev16.query" first, which in turn redirected to the home docs.
So, it's an internal server error.
There was a problem hiding this comment.
The query service seems to be pretty flaky at the moment, not sure what the deal is with that. The link above (msdn.microsoft.com/query/dev16.query?appId=Dev16IDEF1&l=EN-US&k=k($_CSharpKeyword);k(DevLang-csharp)&rd=true) worked for me, and looks how I would expect.
There was a problem hiding this comment.
this link still doesn't seem to work.
There was a problem hiding this comment.
@CyrusNajmabadi Currently it's working with me. The service was down yesterday but is working now, maybe there is some caching issues?
src/VisualStudio/CSharp/Impl/LanguageService/CSharpHelpContextService.cs
Show resolved
Hide resolved
davidwengier
left a comment
There was a problem hiding this comment.
Signing off as far as the help links go, I don't see any issues introduced here. The => issue I mentioned looks like it is pre-existing so no reason to block this PR, but it would be nice to fix if you're in the mood :)
src/VisualStudio/CSharp/Impl/LanguageService/CSharpHelpContextService.cs
Show resolved
Hide resolved
| token.IsKind(SyntaxKind.InterpolatedStringTextToken)) | ||
| { | ||
| text = "::_CSharpKeyword"; | ||
| text = "$_CSharpKeyword"; |
There was a problem hiding this comment.
The query service seems to be pretty flaky at the moment, not sure what the deal is with that. The link above (msdn.microsoft.com/query/dev16.query?appId=Dev16IDEF1&l=EN-US&k=k($_CSharpKeyword);k(DevLang-csharp)&rd=true) worked for me, and looks how I would expect.
src/VisualStudio/CSharp/Impl/LanguageService/CSharpHelpContextService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/CSharp/Impl/LanguageService/CSharpHelpContextService.cs
Show resolved
Hide resolved
|
This is ready for review again after applying suggestions from @davidwengier. |
|
Pinging @davidwengier |
|
I think its really up to the docs team to approve that PR, if they're happy with where that keyword goes, or if they think it should go to one of the specific operator pages, or indeed a new page. |
|
The link still isn't working for me :-/ |
|
@CyrusNajmabadi What if you press F1 anything inside Visual Studio? (await keyword for example) Does it work? |
|
@davidwengier The PR that adds |
|
@davidwengier Anything left to merge this? |
|
@CyrusNajmabadi are you okay with this? |
|
Yup. Thanks! |
Fixes #46986
$_CSharpKeyword: This article is what have this f1 keyword.@_CSharpKeyword: This article is what have this f1 keyword.I removed the following part:
These if conditions are impossible to be met because of the check
SyntaxFacts.IsAssignmentExpressionOperatorTokenbefore them.SyntaxFacts.IsAssignmentExpressionOperatorTokenwill already return true for MinusEqualsToken and PlusEqualsTokene.It even seem that(This was incorrect, I'll revert it)SyntaxFacts.IsAssignmentExpressionOperatorTokenis also redundant, this check is already done inIsOperator.