Title: Tab completion: do not tab-complete filenames when binding to non-string parameters · Issue #14147 · PowerShell/PowerShell · GitHub
Open Graph Title: Tab completion: do not tab-complete filenames when binding to non-string parameters · Issue #14147 · PowerShell/PowerShell
X Title: Tab completion: do not tab-complete filenames when binding to non-string parameters · Issue #14147 · PowerShell/PowerShell
Description: The default tab-completion (command-completion) behavior for command arguments is to complete based on the names of items in the current location (typically, files and directories present in the current file-system directory). However, t...
Open Graph Description: The default tab-completion (command-completion) behavior for command arguments is to complete based on the names of items in the current location (typically, files and directories present in the cu...
X Description: The default tab-completion (command-completion) behavior for command arguments is to complete based on the names of items in the current location (typically, files and directories present in the cu...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/14147
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Tab completion: do not tab-complete filenames when binding to non-string parameters","articleBody":"The default tab-completion (command-completion) behavior for command arguments is to complete based on the names of _items_ in the current location (typically, _files and directories_ present in the current file-system directory).\r\n\r\nHowever, this completion is currently also performed for arguments that will bind to parameters _other_ than _untyped_ or `[string]`-typed (or perhaps also `System.IO.FileInfo` / `System.IO.DirectoryInfo`) parameters, e.g. `[int]`, in which case such completions make no sense.\r\n\r\n(By contrast, custom completions, validation attributes, and `enum`-derived types are handled correctly.)\r\n\r\n## Steps to reproduce\r\n\r\n```powershell\r\n$line = 'function foo { param([int] $bar) $bar }; foo '\r\n\r\n(TabExpansion2 $line $line.Length).CompletionMatches.Count | Should -Be 0\r\n```\r\n\r\n## Expected behavior\r\n\r\nThe test should succeed.\r\nThat is, no completion should occur, because tab-completing an `[int]` value (without validation attributes / custom completions) makes no sense.\r\n\r\n## Actual behavior\r\n\r\nThe test fails, because completion based on the item names (files and directories) in the current directory was performed:\r\n\r\n```none\r\nExpected 0, but got 526.\r\n```\r\n\r\n## Environment data\r\n\r\n\r\n```none\r\nPowerShell Core 7.2.0-preview.1\r\n```\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2020-11-19T20:51:38Z","url":"https://github.com/PowerShell/PowerShell/issues/14147"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:27a2248d-748f-7817-3170-b66684958930 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E3BC:C078E:37A91:4EDA6:6AFDFA1F |
| html-safe-nonce | 3057556ff6dcb761b8f3edbfef319cab8b0bf86122205540e51341df5b807a1a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0JDOkMwNzhFOjM3QTkxOjRFREE2OjZBRkRGQTFGIiwidmlzaXRvcl9pZCI6IjUxODA0OTQyNzAzODA3Njc3NzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 01fd487f0348891ce08c6d79e6961d3a2786878aaf71faf3c3b3984e243e6558 |
| hovercard-subject-tag | issue:746915223 |
| 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/14147/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d082a5ab5406b88ca022143ee1eb4c979d00867be6deb7aa6dc40b1bce7b1e7a/PowerShell/PowerShell/issues/14147 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d082a5ab5406b88ca022143ee1eb4c979d00867be6deb7aa6dc40b1bce7b1e7a/PowerShell/PowerShell/issues/14147 |
| og:image:alt | The default tab-completion (command-completion) behavior for command arguments is to complete based on the names of items in the current location (typically, files and directories present in the cu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | ee3343385a977757dd145b28fabf4a119780f2615a5a36c5a89f66c9b3b5616d |
| 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 | 43ae91995f6e2d5ff7a491f3de438f1f723adeaa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width