Skip to content
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

Add support for opening the Suggestions UI with recent commands #14943

Merged
merged 95 commits into from
Aug 15, 2023

Conversation

zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented Mar 2, 2023

⚠️ targets #14938 ⚠️

This adds support for a new action, showSuggestions, as described in #14864. This adds just one source currently, recentCommands. This requires shell integration to be enabled in the shell to work properly. When it is enabled, activating that action will invoke the suggestions UI as a palette, populated with sendInput actions for each of the user's recent commands.

  • These don't persist across reboots.
  • These are per-control.

There's mild plans to remedy that in a follow-up, though that needs a bit more design consideration.

Closes #14779

gh-14779-recent-commands-for-pr

zadjii-msft and others added 30 commits April 28, 2022 16:14
…Ev-DaYs' into dev/migrie/fhl-2023/pwsh-autocomplete-demo
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

schema!

src/buffer/out/Row.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalControl/ControlCore.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/SuggestionsControl.cpp Outdated Show resolved Hide resolved
src/buffer/out/Row.cpp Outdated Show resolved Hide resolved
Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
Base automatically changed from dev/migrie/fhl-2023/pwsh-autocomplete-demo to main August 14, 2023 10:46
@microsoft-github-policy-service microsoft-github-policy-service bot added Issue-Task It's a feature request, but it doesn't really need a major design. Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. labels Aug 14, 2023
Comment on lines +104 to +109
if (Visibility() == Visibility::Visible && _direction == TerminalApp::SuggestionsDirection::BottomUp)
{
auto m = this->Margin();
m.Top = (_anchor.Y - ActualHeight());
this->Margin(m);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the reliance on the cached _direction member here will lead to bugs. I think it would be more robust if there was a common function that would recompute the entire layout whenever any of its parameters change.
I mean a size change should lead to potential a call to _setDirection right? If there was less state here and more "recomputations" (English word 404), would this be simpler? As such I think that this code should be abstracted: https://github.com/microsoft/terminal/blob/dev/migrie/f/14779-sxnui-recent-commands/src/cascadia/TerminalApp/SuggestionsControl.cpp#L1088-L1103
...but it might be necessary to move even more logic in there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I was hoping that by just starting with the right direction based off the size it opened with, then anything smaller would still make sense in that direction.

I worry that like, trying to rearrange the layout of the control while the size is changing is just gonna trigger another size change. I'm sure there's a correct way to do this with the Arrange/Layout events in WinUI, but that's a dark part of the framework I've been trying my best to avoid 😅

src/cascadia/TerminalControl/ControlCore.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalControl/ControlCore.idl Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/Command.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/Command.cpp Outdated Show resolved Hide resolved
@zadjii-msft zadjii-msft merged commit e5a430f into main Aug 15, 2023
17 checks passed
@zadjii-msft zadjii-msft deleted the dev/migrie/f/14779-sxnui-recent-commands branch August 15, 2023 13:48
@zadjii-msft
Copy link
Member Author

From PR body:

gh-14779-recent-commands-for-pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. zBugBash-Consider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recent commands UI
4 participants