Skip to content

Add tooltips for hashtable key completions #17864

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

Merged
merged 13 commits into from
Mar 25, 2025

Conversation

MartinGC94
Copy link
Contributor

@MartinGC94 MartinGC94 commented Aug 9, 2022

PR Summary

Fixes #15450

Add tooltips for hashtable key completions
Use resource files instead of dictionary for comment completion tooltips

PR Context

PR Checklist

Add completion for calculated properties for Compare-Object and ConvertTo-HTML
Add argument completer for the Property parameter of ConvertTo-Html
Use resource files instead of dictionary for comment completion tooltips
@MartinGC94 MartinGC94 closed this Aug 10, 2022
@MartinGC94 MartinGC94 reopened this Aug 10, 2022
@iSazonov iSazonov requested a review from daxian-dbw August 11, 2022 10:15
@ghost ghost added the Review - Needed The PR is being reviewed label Aug 19, 2022
@ghost
Copy link

ghost commented Aug 19, 2022

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@MartinGC94 MartinGC94 closed this May 3, 2023
@MartinGC94 MartinGC94 reopened this May 3, 2023
@TravisEz13
Copy link
Member

@daxian-dbw Can you review?

@ghost ghost removed the Review - Needed The PR is being reviewed label May 8, 2023
@ghost ghost added the Review - Needed The PR is being reviewed label May 16, 2023
@ghost
Copy link

ghost commented May 16, 2023

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@pull-request-quantifier-deprecated

This PR has 360 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Large
Size       : +315 -45
Percentile : 76%

Total files changed: 3

Change summary by file extension:
.cs : +85 -28
.resx : +212 -0
.ps1 : +18 -17

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@iSazonov
Copy link
Collaborator

@MartinGC94 Are all these changes related, or can you break them down into different PRs?

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Mar 20, 2025
@MartinGC94
Copy link
Contributor Author

MartinGC94 commented Mar 20, 2025

@iSazonov Everything except the additional switch cases for Compare-Object and ConvertTo-Html are related. I can pull out those changes but it's like 10 lines of code that we "save" on that, so not sure if it's worth it, but it's up to you.

-Edit: I changed my mind and removed the irrelevant changes. The PR could be further split into tooltips for hashtables, and updating the tooltips for help keywords to use the resource file but then I'd have to deal with annoying merge conflicts so I'd prefer not to.

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Mar 24, 2025
@iSazonov

This comment was marked as outdated.

This comment was marked as outdated.

</data>
<data name="DepthHashtableKeyDescription" xml:space="preserve">
<value>[int]
The depth key allows you to specify the depth of expansion per property.</value>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please reword like:

Suggested change
The depth key allows you to specify the depth of expansion per property.</value>
The depth key specifies the depth of expansion per property.</value>
</data>
<data name="AscendingHashtableKeyDescription" xml:space="preserve">
<value>[bool]
Allows you to specify the order of sorting for one or more properties.</value>
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same.

</data>
<data name="DescendingHashtableKeyDescription" xml:space="preserve">
<value>[bool]
Allows you to specify the order of sorting for one or more properties.</value>
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same.

</data>
<data name="DataHashtableKeyDescription" xml:space="preserve">
<value>[string[]]
Selects events with any of the specified values in the EventData section.</value>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add an example in the help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tooltips generally don't have examples. I'm also not sure how much value there would be in something like: Get-WinEvent -FilterHashtable @{LogName="System";ID=7040;Data="BITS"} because unless you happen to have the raw event data in front of you, you won't know what field "BITS" refers to. The same goes for the SuppressHashFilter suggestion.

</data>
<data name="SuppressHashFilterHashtableKeyDescription" xml:space="preserve">
<value>[hashtable]
Excludes events that match the values specified in the hashtable.</value>
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same.

Comment on lines +485 to +497
<data name="CommentHelpSYNOPSISKeywordDescription" xml:space="preserve">
<value>A brief description of the function or script.
This keyword can be used only once in each topic.</value>
</data>
<data name="CommentHelpDESCRIPTIONKeywordDescription" xml:space="preserve">
<value>A detailed description of the function or script.
This keyword can be used only once in each topic.</value>
</data>
<data name="CommentHelpPARAMETERKeywordDescription" xml:space="preserve">
<value>.PARAMETER &lt;Parameter-Name&gt;
The description of a parameter.
Add a .PARAMETER keyword for each parameter in the function or script syntax.</value>
</data>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe use the same pattern started with keyword everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean replacing all the *HashtableKeyDescription instances with HashtableKeyDescription*? (Example: StartTimeHashtableKeyDescription -> HashtableKeyDescriptionStartTime)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean .PARAMETER in help text.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. The point of .PARAMETER <Parameter-Name> is to show the required syntax. I use it for all the help keywords that take some sort of parameter, for example: EXTERNALHELP and FORWARDHELPCATEGORY. For the help keywords that don't take any arguments (SYNOPSIS and others) I don't see any reason to include an extra line with just the keyword.

@iSazonov
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).
@iSazonov iSazonov assigned iSazonov and unassigned TravisEz13 Mar 25, 2025
@iSazonov iSazonov enabled auto-merge (squash) March 25, 2025 05:11
@iSazonov iSazonov merged commit 1ac3ff1 into PowerShell:master Mar 25, 2025
38 of 40 checks passed
Copy link
Contributor

microsoft-github-policy-service bot commented Mar 25, 2025

📣 Hey @MartinGC94, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Large
4 participants