-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 "Tasks" in the Suggestions UI #15664
Conversation
…Ev-DaYs' into dev/migrie/fhl-2023/pwsh-autocomplete-demo
…nui-recent-commands
…ie/f/sxnui-useCommandline
auto base{ RS_(L"SuggestionsCommandKey") }; | ||
switch (Source()) | ||
std::wstringstream ss; | ||
ss << RS_(L"SuggestionsCommandKey").c_str(); |
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.
nit: std::wstring_view{ RS_(L"SuggestionsCommandKey") }
.
You can also just use std::wstring::append()
instead of using wstringsteam
, because string streams are fairly hefty.
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.
looks like we merged with the ss and the comment unresolved 😄
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.
✅ with nits.
_subcommands = winrt::single_threaded_map<winrt::hstring, Model::Command>(); | ||
|
||
for (const auto& n : nested) | ||
{ | ||
_subcommands.Insert(n.Name(), n); | ||
} |
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.
Oh, I forgot to mark this one for the std::vector
vs. IVector
thing
The primary goals of this format is to allow a simple XML format | ||
that is mostly human readable. The generation and parsing of the | ||
various data types are done through the TypeConverter classes | ||
|
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.
Okay, this is the VS version. With the trailing spaces. Which is insane.
winrt::hstring{ fmt::format(FMT_COMPILE(L"{:\x7f^{}}{}"), | ||
L"", | ||
numBackspaces, | ||
(std::wstring_view)(inArgs ? inArgs.Input() : L"")) }); |
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.
BTW does this really work? I didn't think strict ternary operators allowed this. I thought it would have needed to be something like this:
inArgs ? std::wstring_view{ inArgs.Input() } : std::wstring_view{}
so that each arm of the ternary has the exact same type.
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.
It seemed like it compiled and ran fine? Now that I look at it, it does feel weird that it compiles. I feel like usually the compiler is much more strict about this kind of thing...
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 it's because the hstring gets implicitly turned into a C string. The string-view constructor will then do a strlen to turn it back. That's not particularly optimal, but we also won't die from that. 😅
// then get that here. | ||
const bool shouldGetContext = realArgs.UseCommandline() || | ||
WI_IsFlagSet(source, SuggestionsSource::CommandHistory); | ||
if (shouldGetContext) | ||
{ | ||
if (const auto& control{ _GetActiveControl() }) |
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.
Hey, didn't we make a change on your other suggestions PR to use sender
instead of active control
?
auto base{ RS_(L"SuggestionsCommandKey") }; | ||
switch (Source()) | ||
std::wstringstream ss; | ||
ss << RS_(L"SuggestionsCommandKey").c_str(); |
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.
looks like we merged with the ss and the comment unresolved 😄
@@ -931,4 +931,72 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation | |||
{ | |||
return _ExpandedCommandsCache; | |||
} | |||
|
|||
IVector<Model::Command> _filterToSendInput(IMapView<hstring, Model::Command> nameMap, |
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.
rude! this is not filtering, this is constructing a completely different set of commands. that's a different operation than filtering.
targets #15027
Adds a new suggestion source,
tasks
, that allows a user to open the Suggestions UI withsendInput
commands saved in their settings.source
becomes a flag setting, so it can be combined like so:If a nested command has
sendInput
commands underneath it, this will build a tree of commands that only includesendInput
s as leaves (but leave the rest of the nesting structure intact).References and Relevant Issues
Closes #1595
See also #13445
As spec'd in #14864
Validation Steps Performed
Tested manually