Skip to content

Enable tab completion for variable assignment that is enum #10646

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 12 commits into from
Oct 14, 2019

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Sep 29, 2019

PR Summary

Add code to CompletionAnalysis class to detect if completion is for variable assignment and the variable is an enum. Then use helper GetResultForEnum() to return appropriate results matching string to complete. Enum strings are always quoted and will match initial single or double quote. Needed to have similar code in 3 places to handle:

$ErrorActionPreference = <tab>
$ErrorActionPreference = '<tab> # in this case, it's a string completion
$ErrorActionPreference=<tab>

Although it's not in this gif, the results are sorted by enum name alphabetically.

img

PR Context

Fix #10631

PR Checklist

@SteveL-MSFT
Copy link
Member Author

@PoshChan please retry windows

@PoshChan
Copy link
Collaborator

@SteveL-MSFT, successfully started retry of PowerShell-CI-Windows

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 5, 2019
@iSazonov iSazonov added this to the 7.0.0-preview.5 milestone Oct 5, 2019
Copy link
Collaborator

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

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

LGTM

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Oct 8, 2019
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 10, 2019
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Oct 10, 2019
@daxian-dbw daxian-dbw merged commit 0842fe8 into PowerShell:master Oct 14, 2019
@SteveL-MSFT SteveL-MSFT deleted the enum-completer branch October 14, 2019 16:55
@ghost
Copy link

ghost commented Oct 23, 2019

🎉v7.0.0-preview.5 has been released which incorporates this pull request.:tada:

Handy links:

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable tab completion for variables that are of enum type
6 participants