Title: Add a way to lazily autoload argument completers · Issue #17283 · PowerShell/PowerShell · GitHub
Open Graph Title: Add a way to lazily autoload argument completers · Issue #17283 · PowerShell/PowerShell
X Title: Add a way to lazily autoload argument completers · Issue #17283 · PowerShell/PowerShell
Description: Summary of the new feature / enhancement Currently, argument completers for native commands must be explicitly registered using Register-ArgumentCompleter. However, this means that the module which registers the completer must be eagerly...
Open Graph Description: Summary of the new feature / enhancement Currently, argument completers for native commands must be explicitly registered using Register-ArgumentCompleter. However, this means that the module which...
X Description: Summary of the new feature / enhancement Currently, argument completers for native commands must be explicitly registered using Register-ArgumentCompleter. However, this means that the module which...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/17283
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add a way to lazily autoload argument completers","articleBody":"### Summary of the new feature / enhancement\n\nCurrently, argument completers for native commands must be explicitly registered using `Register-ArgumentCompleter`. However, this means that the module which registers the completer must be eagerly loaded in `$PROFILE` during startup, otherwise the completions aren't loaded. If many different argument completers are registered, this may take a considerable amount of time on each startup, even when most of the completions are never used in the session.\n\nAs an example, importing `https://github.com/MatejKafka/PowerShell-ArgumentCompleters` takes about 175 ms on my computer. Currently, I'm loading them in an `OnIdle` event callback, which helps, but it's still not ideal and doesn't scale well to a larger number of completers.\n\nIt would be nice to add autoloading support for argument completers. Completions for native commands (together with inline description) are the main reason why I prefer `fish` shell autocompletion over the one in PowerShell.\n \n---\n\nAs an additional food for thought (which is definitely out-of-scope for this issue), currently there isn't any official repository for argument completers. If that was added, it could be possibly to interactively offer the user to download completions for the given command (if available) when they first trigger autocomplete on it, greatly improving the experience of using native commands in PowerShell. It already kinda works this way on Linux, where many packages also install autocompleters for commonly used shells.\n\n### Proposed technical implementation details (optional)\n\nPossible implementation: Add an entry to the module manifest, listing the commands for which it provides argument completers. When completions for the command are requested, the module is autoloaded, which registers the argument completers.\n\nThis implementation has an issue where if the module is large (slow to load), there may be a considerable delay before the completions appear. This could be further improved by also specifying which file contains the argument completer for the given command, so that only that file could be loaded, without loading the whole module. This would allow for one big module, which registers many different completers, each in a separate file, without having to load the whole module.","author":{"url":"https://github.com/MatejKafka","@type":"Person","name":"MatejKafka"},"datePublished":"2022-05-06T23:21:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":21},"url":"https://github.com/17283/PowerShell/issues/17283"}
| 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:3d889859-96da-e9ff-3020-3e1532b2060b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C33C:260260:CCC333:11820A4:6992EAC2 |
| html-safe-nonce | 3f9af8ac5695876a59f8a3da083687a2a6c6847d7412845fa925f845612d62d3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzNDOjI2MDI2MDpDQ0MzMzM6MTE4MjBBNDo2OTkyRUFDMiIsInZpc2l0b3JfaWQiOiIzOTUxMjIxMTgzNjY4NzQyODUxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c4bd5045c9608d31ac116d4328390819b039ca42c6d953e6fc58814bc5fe8bc5 |
| hovercard-subject-tag | issue:1228452883 |
| 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/17283/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b83a8af67110416098e64a7de7b896a4ed2aa3d194d42c84fb8f19d88df7bb0b/PowerShell/PowerShell/issues/17283 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b83a8af67110416098e64a7de7b896a4ed2aa3d194d42c84fb8f19d88df7bb0b/PowerShell/PowerShell/issues/17283 |
| og:image:alt | Summary of the new feature / enhancement Currently, argument completers for native commands must be explicitly registered using Register-ArgumentCompleter. However, this means that the module which... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MatejKafka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| 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 | 84dcb133269e3cfe6e0296cc85fbacb92cae92bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width