Skip to content

Conversation

@MartinGC94
Copy link
Contributor

@MartinGC94 MartinGC94 commented Apr 15, 2023

PR Summary

Adds the commands:

  • Get-CompletionOptions
  • Set-CompletionOptions

which allows the user to view and change various code completion related settings.
Currently there are 4 options available:

1: AddTrailingSeparatorForContainers (bool) which determines whether or not a separator should be added at the end of directory completions, like: gci C:\Windo<Tab> -> C:\Windows\

2: PreferredPathSeparator (Enum) which determines how to handle separators when completing file paths. There are 4 possible values:

  1. Default - Current behavior where it uses the separator specified in the provider.
  2. LastUsed - Uses whichever separator was last seen in the input text, or if no separator was seen, the default specified in the provider.
  3. Slash - Always uses a regular slash (/)
  4. Backslash - Always uses a backslash ()

3: PathSorting (Enum) which determines how path completion results are sorted. Default behavior is to sort by the full path but this can be turned off, or changed to list containers first.

4: ExcludedModules (string array) which allows users to exclude commands from certain modules from the completion results.

PR Context

Fixes #18963

As mentioned in that issue there are various user requests to change code completion behavior and some of those requests may not be suited for everyone.
We already have the "Options" hashtable in Tabexpansion2 but it's not very user friendly to edit that function to change completion options you may want to change on the fly.
A point worth discussing would be if we should include the existing completion options (Include hidden fileshares, relative/full paths and literal VS normal paths).
I decided to take inspiration from Register-ArgumentCompleter and make these options into commands, rather than a PS variable but either option is fine by me.

PR Checklist

@ghost
Copy link

ghost commented Apr 23, 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

@daxian-dbw daxian-dbw added the WG-Cmdlets general cmdlet issues label May 1, 2023
@daxian-dbw daxian-dbw marked this pull request as draft May 1, 2023 18:08
@daxian-dbw daxian-dbw added the Needs-Triage The issue is new and needs to be triaged by a work group. label May 1, 2023
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label May 5, 2023
@StevenBucher98 StevenBucher98 added the PowerShell-Docs needed The PR was reviewed and a PowerShell Docs update is needed label May 8, 2023
@ghost ghost added the Stale label May 23, 2023
@ghost
Copy link

ghost commented May 23, 2023

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

@doctordns
Copy link
Collaborator

I am NOT an expert in the code - but I did look! For my benefit where are these completion options to be stored? Are they persisted?

Also - what is the status on this?

@ghost ghost removed the Stale label May 24, 2023
@MartinGC94
Copy link
Contributor Author

MartinGC94 commented May 24, 2023

I am NOT an expert in the code - but I did look! For my benefit where are these completion options to be stored? Are they persisted?

In the execution context (same place that argument completers are stored) so no, it's not persistent.

Also - what is the status on this?

I was waiting on the path completion improvements PR to get merged (which happened earlier this week) as well as the ExcludeModule parameter PR: #18955
With the path completion now merged I can at least add the first couple of options.

@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label May 24, 2023
@pull-request-quantifier-deprecated

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


Quantification details

Label      : Medium
Size       : +105 -8
Percentile : 42.6%

Total files changed: 4

Change summary by file extension:
.cs : +105 -8

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.

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label May 28, 2023
@ghost ghost added the Stale label Jun 12, 2023
@ghost
Copy link

ghost commented Jun 12, 2023

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

@MartinGC94
Copy link
Contributor Author

@iSazonov Can you reopen this PR? Now that #18955 has been merged I can finally finish this one.

@microsoft-github-policy-service microsoft-github-policy-service bot removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept Stale labels Dec 30, 2024
@iSazonov iSazonov reopened this Dec 31, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Review - Needed The PR is being reviewed label Dec 31, 2024
@MartinGC94 MartinGC94 changed the title WIP: Add commands for controlling completion options Add commands for controlling completion options Jan 1, 2025
@MartinGC94 MartinGC94 marked this pull request as ready for review January 1, 2025 15:53
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Jan 8, 2025
@microsoft-github-policy-service
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Medium Needs-Triage The issue is new and needs to be triaged by a work group. PowerShell-Docs needed The PR was reviewed and a PowerShell Docs update is needed Review - Needed The PR is being reviewed WG-Cmdlets general cmdlet issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better way to handle completion options

6 participants