Skip to content
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

Add the 'SelectCommandArgument' bind-able function #2222

Merged
merged 1 commit into from
Feb 17, 2021

Conversation

daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Feb 17, 2021

PR Summary

Add the SelectCommandArgument bind-able function.
This functionality was originally proposed by @ThePSAdmin who added a argument selection handler to SamplePSReadLineProfile.ps1 via #1947. This PR adds a built-in function for this functionality with improvements.

Improvements:

  1. Selection of arguments is scoped in script blocks. Based on the cursor position, it searches from the most nested script block to the outmost script block. This offers better user experience when looping through arguments.
  2. When the cursor is at an argument, Ctrl+a selects that specific argument.
  3. Improve the digit arguments handling to treat the positive/negative argument value as a forward/backward offset from the currently selected argument or the current cursor position when no argument is selected.
  4. Some minor fixes and add a lot tests.

PR Checklist

Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Feb 23, 2021

🎉 v2.2.0-beta2 has been released which incorporates this pull request. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant