-
Notifications
You must be signed in to change notification settings - Fork 126
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
Draft spec for auto-discovering feedback provider and tab-completer #386
base: master
Are you sure you want to change the base?
Draft spec for auto-discovering feedback provider and tab-completer #386
Conversation
|
||
Today, to enable a feedback provider or a tab-completer for a native command, | ||
a user has to import a module or run a script manually, or do that in their profile. | ||
There is no way to auto-discover a feedback provider or a tab-completer for a specific native command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider predictors in this set of supported auto discoverable "things"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example the completion predictor may be good to auto register since it doesnt really have any commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There won't be a specific trigger for any predictor, so if needed, a predictor module can just be placed under the _startup_
folder of Feedbacks
or Completions
.
Think about it more, I guess we may want to unify the _startup_
folders from feedbacks
and completions
, since they all will be loaded at startup. Maybe we should have a startup
folder at the same level of feedbacks
and completions
, so any predictor/feedback provider/tab-completer that needs to be loaded at session startup can be put there.
- feedback provider -- a module or an assembly (binary implementation only) | ||
- tab-completer -- a module or a script (binary or script implementation) | ||
|
||
The folders for feedback providers and tab-completers will be placed under the same path where modules folders are currently located: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this going to be affected by the One-Drive issue?
|
||
2. Should we add another key to indicate the target OS? | ||
- A feedback provider may only work on a specific OS, such as the `"WinGet CommandNotFound"` feedback provider only works on Windows. | ||
- Such a key could be handy if a user wants to share the feedback/tab-completer configurations among multiple machines via a cloud drive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be good, thinking about the linux cmd-not-found predictor. Also if a user wants to bring this configuration across their different machines they dont need to have multiple different folder structures? I am not entirely sure how they would necessarily do it but I know some community folks use external tools to share their $PROFILE across machines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they dont need to have multiple different folder structures?
Folder structures under feedbacks
and completions
are the same. I guess a user can create a symbolic link to make <personal>/powershell/feedbacks
or <personal>/powershell/completions
points to the folders from a cloud drive.
- A feedback provider may only work on a specific OS, such as the `"WinGet CommandNotFound"` feedback provider only works on Windows. | ||
- Such a key could be handy if a user wants to share the feedback/tab-completer configurations among multiple machines via a cloud drive. | ||
|
||
3. Do we really need a folder for each feedback provider? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is. there a reason why this all can't be in a single json file? i.e feedbackproviders.json
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tool installation needs to easily deploy/remove the auto-discovery configuration. We want to avoid updating a single file to make that easy.
I see the key elements here - autodiscover, autoload, and trigger. One option was suggested by me a few years ago PowerShell/PowerShell#13428 For example, if we introduce a naming standard, we can put If we need a Everything for modules is familiar and understandable to users and it can be implemented in small steps. |
whose file names should match names of the commands. | ||
Those completion scripts are loaded only when their corresponding commands' completion is triggered for the first time. | ||
|
||
We will have separate directories for feedback providers and tab-completers, for 2 reasons: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will make it not possible for an Appx app to participate since they can't place files outside of their own installed folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned Appx and MSIX packages in the "Discussion Points" below. I think for those apps:
- If they want to provide tab-completer, then the tab-completer needs to be exposed by running the tool with a special flag, such as
<tool> --ps-completion
, then the user can manually create the "deployment+configuration" for the tool using the output script. Or, even better, the user can just run the output script, which will create the deployment automatically. - If they want to provide feedback provider, I'm not sure how that will be possible. According to Add a way to lazily autoload argument completers PowerShell#17283 (comment), the tool's DLL should not be used by another process, but feedback provider and predictor are binary implementation only.
Co-authored-by: Steve Lee <slee@microsoft.com>
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This is a draft spec for auto-discovering feedback provider and tab-completer. Relevant GitHub issues: