Closed daxian-dbw closed 1 year ago
Adding a quick mock up of potential way to render a tool tip in ListView, if a non-null tooltip is available we could render it in a greyed out version beneath the currently selected predictor. Additionally maybe we have a PSReadLine option to render this or not. There is already a ShowToolTips
option but I am unsure what it does?
Edit: looks like ShowToolTips may be for MenuComplete,https://github.com/PowerShell/PSReadLine/blob/f1b204348186929207362bca6ae0c5cbb9d3e3ef/PSReadLine/Completion.cs#L557-L570
cc @daxian-dbw
Just been thinking about this too @daxian-dbw
Would this capture explaining to the user this following behaviour that may be unexpected
When you use the InputObject parameter with ForEach-Object, instead of piping command results to ForEach-Object, the InputObject value is treated as a single object.
@StevenBucher98 I like this idea. It's ideal to use a popup window for tooltips because tooltips may be arbitrary multiple line text, but admittedly, it will be hard to support popup window in PSReadLine without significant changes and re-design.
I think I can quickly implement this and see how it works.
BTW, the ShowToolTips
is for menu completion only, but we can make it control the list view tooltips too.
@kilasuit I'm not sure I understand you comment. Did you mean to comment on a different issue?
Consider reducing the width of ListView and using the right side of the terminal next to the ListView to show tooltip information (with some background color to separate the two sides). This will allow more screen real estate to show multiline information. If there is more information than can fit in that space given the terminal window side, maybe have an indicator and key binding to show the full text in the alternate screen buffer.
using the right side of the terminal next to the ListView to show tooltip information (with some background color to separate the two sides).
It is not easy to do this with the current rendering infrastructure in PSReadLine, but it would be absolutely nice to support this at some point of time. This will be similar to what fzf
does (the file-content-preview feature) -- owning a region of buffer on the screen just like a nested terminal in the terminal only for rendering purpose (not support input within that region).
have an indicator and key binding to show the full text in the alternate screen buffer.
This is a good idea for the ultimate flexibility for tooltip rendering. Take CompletionPredictor
as an example, the tooltip for the method completion is the text of all the overloads of the method, and it's not uncommon to run into a method with over 10 overloads. Tooltip like this will never fit in the main screen, so using alternative screen buffer in that case should be a better option.
@daxian-dbw after some chatter with @SeeminglyScience in the PowerShell discord the other day my comment now makes less sense than it did before.
Close via #3667
Prerequisites
Description of the new feature/enhancement
Today, the
PredictiveSuggestion
type has theTooltip
property, but PSReadLine doesn't use it in its rendering. For completeness, it should render the tooltip, and ideally the tooltips should be displayed in a popup terminal UI window when the user moves the focus to an item in the list, in the form similar to this: https://github.com/waf/CSharpRepl#c-replProposed technical implementation details (optional)
No response