-
Notifications
You must be signed in to change notification settings - Fork 129
Predictive IntelliSense #262
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
Predictive IntelliSense #262
Conversation
Co-Authored-By: Steve Lee <[email protected]>
For "packaging" the feature for native utilities see my comment #261 (comment) and #13428 |
This can be a bit confusing and conflicting with the term Intellisense. I think most would consider Intellisense to be providing on-typing completion of the command or parameter that you get in ISE and VS Code Editor. This initial implementation is more history completion which is different but related. How will this integrate or supplement with the existing MenuComplete feature? Right now MenuComplete's UX is poor when compared to editor Intellisense features. This new feature could greatly enhance that feature to get close to real Intellisense. It would be a great default experience when the Predictive/History part is off. There are really three major parts to this:
Completion Views would be Inline, List, Wide, and Menu (UI Menu emulating intellisense in modern terminals). That would enable the existing MenuComplete to plug into CompletionViews as an InputSource as a default experience. List or Wide as the default on non-VT terminals with Menu as default on VT terminals. If performance of on-demand typing is a concern it could just default to Tab shortcut. When Predictive Intellisense is enabled, I could choose History Predictions or Predictive MenuComplete. A shortcut to toggle between both would be great with the Completion View showing how to switch. I know I want to be able to rapidly use both depending on what I'm doing. Initial offering still should focus on the predictive history feature, but I think clarifying how this will work with MenuComplete is needed. This would be the perfect first extension to validate the extensibility since the Input Source already exists and just needs to plug into the Completion Views with optional Predictions. |
This view is similar to other shells Fish and ZSH. | ||
* ListView – ListView provides a dropdown list of predictions below the line the user is typing. | ||
Users may quickly scan the list, highlight and select the desired prediction. | ||
|
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 be an option for InlineView alongside a secondary view. Inline and List complement each other. Inline can show the suggested completion with List showing multiple options at once.
Additional Views to consider are
- None
- Wide - the view
crtl+space
andFormat-Wide
uses - Menu - VT Sequence Menu that looks like a real intellisense menu that you get in ISE and VS Code Editors
- TerminalIntegration - Long term, there are feature requests to provide native rendering of completion in Windows Terminal. See Enhance shell autocompletion with a cool new user interface and shell completion protocol microsoft/terminal#3121 and ITerm2-like terminal autocomplete microsoft/terminal#6632
These additional views make me think Inline should be separate On/Off with additional views as a separate configuration with None only affecting what's in its list and not Inline setting.
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.
@dragonwolf83 Thank you! We are open to considering additional views as we progress. I agree that InlineView and ListView can be complimentary - currently when using ListView, as you highlight selections, they are displayed fully on the same line as your cursor, similar to InlineView. Appreciate your thoughts and feedback as we move forward.
Goals: | ||
|
||
* Provide extension model to support additional providers | ||
* Support the discovery of providers using Get-Subsystem |
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.
Please consider different noun. Subsystem is way too generic and doesn't make sense for discovery. Get-IntellisenseProvider
or Get-IntellisenseSystem
makes more sense. For easier typing, Get-CompletionProvider
would work too.
Also, please prefix this with PS so it is Get-PSIntellisenseProvider
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.
Prediction plugins are using the general PowerShell subsystem
model, but that cmdlet should probably be called Get-PSSubsystem
, perhaps have a -Type
parameter where Prediction
is a valid type making it easy to filter? -Type
can be added later since we don't support other types currently.
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.
but that cmdlet should probably be called
Get-PSSubsystem
Agreed that we can revisit the cmdlet name.
a -Type parameter where Prediction is a valid type making it easy to filter?
It already does so: Get-Subsystem -Kind CommandPredictor
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.
Agreed that name should be Get-PSSubsystem, will leave currently in RFC as Get-Subsystem until final decision.
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.
The renaming to Get-PSSubsystem
is done.
* History - This option uses only the PSReadLine history for predictions | ||
* Plugin – This option uses only registered plugin modules for predictions | ||
* HistoryAndPlugin – This option uses both for predictions | ||
|
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 this in separate comment but will add here as well. It would be better to separate out Prediction from Source so that we can use History completion in Most Recently Used order rather than a predictive algorithm.
Prediction Method Examples:
- None
- AI Version 1
- Experimental new AI
- Cloud AI using Azure or AWS AI (maybe not but at least possible to add)
I guess source can be singular or additive so an array:
- History
- Menu
- Plugin
Is the plugin able to register itself to be accepted into the configuration list? I may want to try 3-4 different sources but end up with 1-2 as my defaults. Maybe have the 3rd-4th for specialized work on remote environments.
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.
We should consider using Frecency
algorithm rather than most recently used: PowerShell/PSReadLine#1808
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.
@daxian-dbw Thoughts on using frecency algorithm versus Most Recent? I find myself expecting frequency.
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.
The Frecency
algorithm mentioned by @SteveL-MSFT takes into account both frequency and how recent the history is.
* History - This option uses only the PSReadLine history for predictions | ||
* Plugin – This option uses only registered plugin modules for predictions | ||
* HistoryAndPlugin – This option uses both for predictions | ||
|
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.
We should consider using Frecency
algorithm rather than most recently used: PowerShell/PSReadLine#1808
Goals: | ||
|
||
* Provide extension model to support additional providers | ||
* Support the discovery of providers using Get-Subsystem |
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.
Prediction plugins are using the general PowerShell subsystem
model, but that cmdlet should probably be called Get-PSSubsystem
, perhaps have a -Type
parameter where Prediction
is a valid type making it easy to filter? -Type
can be added later since we don't support other types currently.
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 is definitely enough for an experimental release of PSReadline, but there's definitely a few questions below that should probably be answered before we accept this as stable.
Co-authored-by: Joey Aiello <[email protected]> Co-authored-by: Dongbo Wang <[email protected]>
Co-authored-by: Joey Aiello <[email protected]> Co-authored-by: Dongbo Wang <[email protected]>
Users may change the view at the command line using the keybinding F2 or `Set-PSReadLineOption. The | ||
Set-PSReadLineOption may be stored in the user's profile. |
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.
Users may change the view at the command line using the keybinding F2 or `Set-PSReadLineOption. The | |
Set-PSReadLineOption may be stored in the user's profile. | |
Users may change the view at the command line using the keybinding F2 or `Set-PSReadLineOption`. | |
The `Set-PSReadLineOption` may be stored in the user's profile. |
 | ||
|
||
* Searching histroy from cmdlet noun. | ||
- Searching histroy from cmdlet noun. |
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.
- Searching histroy from cmdlet noun. | |
- Searching history from cmdlet noun. |
@PowerShell/powershell-committee is comfortable moving forward with an experimental implementation of this RFC in PS 7.2 and PSReadline 2.2 previews. We'll make adjustments based on user feedback, re-align the RFC to match the implementation, and merge it as approved once we feel comfortable with the experimental implementation. |
|
||
- None - This option disables Predictive IntelliSense | ||
- History - This option uses only the PSReadLine history for predictions | ||
- Plugin – This option uses only registered plugin modules for predictions |
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.
Sounds like we removed this one
module. Removal of registration occurs when the module is removed. | ||
|
||
Starting with PowerShell 7.1 Preview 7, and as an experimental feature of PowerShell 7.1-RC.1, the | ||
`Get-Subsystem` cmdlet is an experimental feature of the `PSSubsystemPluginModel`. To enable the |
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 be Get-PSSubsystem throughout the doc:
`Get-Subsystem` cmdlet is an experimental feature of the `PSSubsystemPluginModel`. To enable the | |
`Get-PSSubsystem` cmdlet is an experimental feature of the `PSSubsystemPluginModel`. To enable the |
To list the currently installed providers and their respective metadata such as version information: | ||
|
||
```powershell | ||
Get-SubSystem -Kind CommandPredictor |
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 be Get-PSSubsystem
Get-SubSystem -Kind CommandPredictor | |
Get-PSSubsystem -Kind CommandPredictor |
Just closed this because @theJasonHelmick's original fork was deleted a while back, and his new pushed changes weren't updating here. |
No description provided.