Title: Pseudo binding for tab completion doesn't work property for positional arguments · Issue #17653 · PowerShell/PowerShell · GitHub
Open Graph Title: Pseudo binding for tab completion doesn't work property for positional arguments · Issue #17653 · PowerShell/PowerShell
X Title: Pseudo binding for tab completion doesn't work property for positional arguments · Issue #17653 · PowerShell/PowerShell
Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerShell 5.1 and PowerShell. Steps to reprodu...
Open Graph Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
X Description: Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/17653
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pseudo binding for tab completion doesn't work property for positional arguments","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://docs.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nConsider this example:\r\n```\r\nfunction Verb-Noun\r\n{\r\n Param\r\n (\r\n [Parameter(Position = 0)]\r\n [string]\r\n $Param1,\r\n [Parameter(Position = 1)]\r\n [System.Management.Automation.ActionPreference]\r\n $Param2\r\n )\r\n}\r\nVerb-Noun -Param1 Hello \u003cTab\u003e\r\n```\r\nI would expect the tab completion to suggest values for Param2 because it's the first positional parameter that hasn't been bound to a named parameter and this is how the real parameter binder works. Unfortunately it doesn't work, it simply falls back to the file/directory suggestions. \r\nThe same issue occurs if you (presumably by mistake) try to start the positional parameters at 1 instead of 0:\r\n```\r\nfunction Verb-Noun\r\n{\r\n Param\r\n (\r\n [Parameter(Position = 1)]\r\n [System.Management.Automation.ActionPreference]\r\n $Param1\r\n )\r\n}\r\nVerb-Noun \u003cTab\u003e\r\n```\r\n\r\nAs far as I can tell the issue is here: https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs#L1596 where it looks if the position for the parameter matches exactly the position the cursor is at.\n\n### Expected behavior\n\n```console\nTab completion should find the right parameter to offer completions for.\n```\n\n\n### Actual behavior\n\n```console\nIt falls back to the generic file/directory completion\n```\n\n\n### Error details\n\n_No response_\n\n### Environment data\n\n```powershell\nPS C:\\\u003e $PSVersionTable\r\n\r\nName Value\r\n---- -----\r\nPSVersion 7.3.0-preview.5\r\nPSEdition Core\r\nGitCommitId 7.3.0-preview.5\r\nOS Microsoft Windows 10.0.19044\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\n```\n\n\n### Visuals\n\n_No response_","author":{"url":"https://github.com/MartinGC94","@type":"Person","name":"MartinGC94"},"datePublished":"2022-07-09T12:54:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/17653/PowerShell/issues/17653"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e452c01d-f8dc-81f2-f0a3-b6103141ae79 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CAA0:291741:2C304B1:3FB4612:6A551BDC |
| html-safe-nonce | 29f49d9ee8dfb8756e5ca83dfc3286f94261b051d246491ee498b4d6413777b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUEwOjI5MTc0MToyQzMwNEIxOjNGQjQ2MTI6NkE1NTFCREMiLCJ2aXNpdG9yX2lkIjoiMzA1MTM1NzE5MzY0OTg1NTQ1MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9dd86e313cc722a9d85a0f3f2cfccad825718f6db5222ec4b140bf7e0ea8e916 |
| hovercard-subject-tag | issue:1299676695 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/17653/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0f94ad1fb65b54d34fd8752e2d0efe58e290867b4024d792fdc5c771d791c907/PowerShell/PowerShell/issues/17653 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0f94ad1fb65b54d34fd8752e2d0efe58e290867b4024d792fdc5c771d791c907/PowerShell/PowerShell/issues/17653 |
| og:image:alt | Prerequisites Write a descriptive title. Make sure you are able to repro it on the latest released version Search the existing issues. Refer to the FAQ. Refer to Differences between Windows PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MartinGC94 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 682d273eacb2ac51680c6eb9c0b270f029f7ce74c32090f319083c34497e28a5 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b6d37c6470adadff4194742daaab9a817cc4980 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width