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.
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.
looks like we merged with the ss and the comment unresolved 😄
| _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.
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.
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.
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.
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.
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. 😅
| WI_IsFlagSet(source, SuggestionsSource::CommandHistory); | ||
| if (shouldGetContext) | ||
| { | ||
| if (const auto& control{ _GetActiveControl() }) |
There was a problem hiding this comment.
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.
looks like we merged with the ss and the comment unresolved 😄
| return _ExpandedCommandsCache; | ||
| } | ||
|
|
||
| IVector<Model::Command> _filterToSendInput(IMapView<hstring, Model::Command> nameMap, |
There was a problem hiding this comment.
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 withsendInputcommands saved in their settings.sourcebecomes a flag setting, so it can be combined like so:{ "keys": "ctrl+shift+h", "command": { "action": "suggestions", "source": "commandHistory", "useCommandline":true }, }, { "keys": "ctrl+shift+y", "command": { "action": "suggestions", "source": "tasks", "useCommandline":false }, }, { "keys": "ctrl+shift+b", "command": { "action": "suggestions", "source": ["all"], "useCommandline":true }, },If a nested command has
sendInputcommands underneath it, this will build a tree of commands that only includesendInputs 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