Skip to content

Provide f1 help for discards#59543

Merged
CyrusNajmabadi merged 3 commits intodotnet:mainfrom
CyrusNajmabadi:f1discard
Feb 15, 2022
Merged

Provide f1 help for discards#59543
CyrusNajmabadi merged 3 commits intodotnet:mainfrom
CyrusNajmabadi:f1discard

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Found when trying to help a community member out with discards. Tagging @BillWagner to ensure we have an appropriate doc this will link to.

Copy link
Copy Markdown
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.

I opened the docs PR dotnet/docs#28241 :)

return symbol != null;
if (symbol is IDiscardSymbol)
{
text = Keyword("_");
Copy link
Copy Markdown
Member

@davidwengier davidwengier Feb 14, 2022

Choose a reason for hiding this comment

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

I would prefer Keyword("discard") to make it clearer, and avoid future disambiguation on the docs side.

Also, how do you feel about handling IParameterSymbol where the name is _ because _ => goo(); is not a discard to the compiler, but probably is to the user

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would prefer Keyword("discard") to make it clearer, and avoid future disambiguation on the docs side.

@BillWagner what do you think? I can see that we send punction for a lot of the symbols (like ?_CSharpKeyword). Would you prefer us to continue that here, os use a name like discard?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also, how do you feel about handling IParameterSymbol where the name is _ because _ => goo(); is not a discard to the compiler, but probably is to the user

I'll think about it, but i don't feel great about it :)

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.

We certainly do send punctuation in other scenarios, but then also have to come in here and disambiguate later (eg #47516 and #46987). Feels like this is a good opportunity to preempt that.. for example, we should probably add help for the digit separator, which is also an underscore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

k!

@CyrusNajmabadi CyrusNajmabadi merged commit d4440b7 into dotnet:main Feb 15, 2022
@ghost ghost added this to the Next milestone Feb 15, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the f1discard branch February 18, 2022 20:49
@RikkiGibson RikkiGibson modified the milestones: Next, 17.2.P2 Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants