Title: CompleteInput ignoring registered ArgumentCompleters when passed Script or AST · Issue #10567 · PowerShell/PowerShell · GitHub
Open Graph Title: CompleteInput ignoring registered ArgumentCompleters when passed Script or AST · Issue #10567 · PowerShell/PowerShell
X Title: CompleteInput ignoring registered ArgumentCompleters when passed Script or AST · Issue #10567 · PowerShell/PowerShell
Description: When [System.Management.Automation.CommandCompletion]::CompleteInput is provided a ScriptBlock or AST that has a definition of the command to be completed in it the ArgumentCompleters that are registered in the PowerShell instance are ig...
Open Graph Description: When [System.Management.Automation.CommandCompletion]::CompleteInput is provided a ScriptBlock or AST that has a definition of the command to be completed in it the ArgumentCompleters that are regi...
X Description: When [System.Management.Automation.CommandCompletion]::CompleteInput is provided a ScriptBlock or AST that has a definition of the command to be completed in it the ArgumentCompleters that are regi...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/10567
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"CompleteInput ignoring registered ArgumentCompleters when passed Script or AST","articleBody":"When [System.Management.Automation.CommandCompletion]::CompleteInput is provided a ScriptBlock or AST that has a definition of the command to be completed in it the ArgumentCompleters that are registered in the PowerShell instance are ignored.\r\n\r\nThis issue is mostly visible when an editor(Visual Studio Code) leverages the CompleteInput to provide Intellisense(As seen in PowerShell/vscode-powershell#2162 ).\r\n\r\n@powershell/powershell I am currently working on a fix for this and will submit a PullRequest if deemed valid.\r\n\r\n# Steps to reproduce\r\n\r\n```powershell\r\n$script = @'\r\nfunction Test-Completion {\r\n\tparam (\r\n\t\t[String]$TestVal\r\n\t)\r\n}\r\n\r\n[scriptblock]$completer = {\r\n\tparam($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)\r\n\t@('Val1','Val2','Val3')\r\n}\r\n\r\nRegister-ArgumentCompleter -CommandName Test-Completion -ParameterName TestVal -ScriptBlock $completer\r\n\r\nTest-Completion -TestVal \r\n'@\r\n\r\n$scriptBl = {\r\n\tfunction Test-Completion {\r\n\t\tparam (\r\n\t\t\t[String]$TestVal\r\n\t\t)\r\n\t}\r\n\r\n\t[scriptblock]$completer = {\r\n\t\tparam($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)\r\n\r\n\t\t@('Val1', 'Val2', 'Val3')\r\n\t}\r\n\r\n\tRegister-ArgumentCompleter -CommandName Test-Completion -ParameterName TestVal -ScriptBlock $completer\r\n}\r\n\r\n$pwsh = [PowerShell]::Create()\r\n$pwsh.AddScript($scriptBl)\r\n$pwsh.Invoke()\r\n\r\n\r\n([System.Management.Automation.CommandCompletion]::CompleteInput($script, $script.Length, $null, $pwsh)).CompletionMatches\r\n```\r\n\r\n# Expected behavior\r\n\r\n```none\r\nCompletionText ListItemText ResultType ToolTip\r\n-------------- ------------ ---------- -------\r\nVal1 Val1 Text Val1\r\nVal2 Val2 Text Val2\r\nVal3 Val3 Text Val3\r\n```\r\n\r\n# Actual behavior\r\n\r\n```none\r\nList of files from my home directory\r\n```\r\n\r\n# Environment data\r\n\r\n\u003c!-- provide the output of $PSVersionTable -->\r\n\r\n```none\r\nName Value\r\n---- -----\r\nPSVersion 6.2.2\r\nPSEdition Core\r\nGitCommitId 6.2.2\r\nOS Darwin 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64\r\nPlatform Unix\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n```\r\n","author":{"url":"https://github.com/M1kep","@type":"Person","name":"M1kep"},"datePublished":"2019-09-18T06:18:51Z","url":"https://github.com/PowerShell/PowerShell/issues/10567"}
| 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:4a9f985a-4886-8c46-6747-4579f28a9dd1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C070:3D2372:646ED:88865:6AFD48BC |
| html-safe-nonce | c0380ce34c4a57dff2ff3e025db4153aaf947395382265e0a566dd9bc161434f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDcwOjNEMjM3Mjo2NDZFRDo4ODg2NTo2QUZENDhCQyIsInZpc2l0b3JfaWQiOiIxNjYwMDg0NDgxODAyNzE3MzcyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9a9a1571eb38adaf476cb7aaea2912ebb5584980339087e23bb37be2f62b543f |
| hovercard-subject-tag | issue:495012016 |
| 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/10567/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ca7492b2ed72c83458c9abed49901a094754916bde05ca50b7ce9a04b800d4af/PowerShell/PowerShell/issues/10567 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ca7492b2ed72c83458c9abed49901a094754916bde05ca50b7ce9a04b800d4af/PowerShell/PowerShell/issues/10567 |
| og:image:alt | When [System.Management.Automation.CommandCompletion]::CompleteInput is provided a ScriptBlock or AST that has a definition of the command to be completed in it the ArgumentCompleters that are regi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | M1kep |
| hostname | github.com |
| expected-hostname | github.com |
| None | bdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474 |
| 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 | 556dd37bb0aceffb25724e151b5d858b3265b40b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width