-
-
Notifications
You must be signed in to change notification settings - Fork 326
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 preserve last action keyword options #3118
Conversation
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
|
📝 WalkthroughWalkthroughThe changes in this pull request involve modifications to the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)
373-375
: Add XML documentation for enum valuesThe new enum values correctly implement the requested functionality for preserving/selecting last action keywords. To improve maintainability, consider adding XML documentation for all enum values:
public enum LastQueryMode { + /// <summary> + /// The last query will be selected when Flow Launcher is shown + /// </summary> Selected, + /// <summary> + /// The query will be empty when Flow Launcher is shown + /// </summary> Empty, + /// <summary> + /// The last query will be preserved when Flow Launcher is shown + /// </summary> Preserved, + /// <summary> + /// Only the action keyword from the last query will be preserved when Flow Launcher is shown + /// </summary> ActionKeywordPreserved, + /// <summary> + /// Only the action keyword from the last query will be selected when Flow Launcher is shown + /// </summary> ActionKeywordSelected }Flow.Launcher/ViewModel/MainViewModel.cs (1)
1404-1413
: Refactor animation delay handlingThe animation delay handling is duplicated across case blocks. Consider extracting it to make the code more maintainable.
Consider refactoring the animation delay handling:
+ private async Task HandleAnimationDelay() + { + if (Settings.UseAnimation) + await Task.Delay(100); + } + case LastQueryMode.ActionKeywordPreserved or LastQueryMode.ActionKeywordSelected: var newQuery = _lastQuery?.ActionKeyword ?? string.Empty; if (!string.IsNullOrEmpty(newQuery)) newQuery += " "; ChangeQueryText(newQuery); - if (Settings.UseAnimation) - await Task.Delay(100); + await HandleAnimationDelay(); if (Settings.LastQueryMode == LastQueryMode.ActionKeywordSelected) LastQuerySelected = false; break;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs
(3 hunks)Flow.Launcher/Languages/en.xaml
(1 hunks)Flow.Launcher/ViewModel/MainViewModel.cs
(4 hunks)
🔇 Additional comments (3)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (2)
65-65
: Formatting change only
190-190
: Document the purpose of AlwaysStartEn
property
This new property appears to be unrelated to the PR's objective of adding preserve last action keyword options. Please:
- Add XML documentation comments explaining its purpose
- Verify if this change should be part of this PR
+ /// <summary>
+ /// When true, Flow Launcher will always start with English input method
+ /// </summary>
public bool AlwaysStartEn { get; set; } = false;
Flow.Launcher/Languages/en.xaml (1)
70-71
: LGTM: String resources properly added
The new string resources for action keyword options are well-formatted and consistently named, following the existing pattern for LastQuery related strings.
Looks cool! I wonder maybe it would be interesting to allow custom hotkey to perform this action (so sometimes if we (don't) want to delete the query we could use a different hotkey). |
Something like pressing If that's what you meant, this does sound like it could be useful to some people, but that feature is outside the scope of this PR. |
newQuery += " "; | ||
ChangeQueryText(newQuery); | ||
if (Settings.UseAnimation) | ||
await Task.Delay(100); |
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.
Why do we wait here?
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.
Ok because using animation, think previously other options had some issues when animation is in process.
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'm actually not sure. It's mentioned here
Flow.Launcher/Flow.Launcher/ViewModel/MainViewModel.cs
Lines 1390 to 1403 in 0506f09
case LastQueryMode.Empty: | |
ChangeQueryText(string.Empty); | |
await Task.Delay(100); //Time for change to opacity | |
break; | |
case LastQueryMode.Preserved: | |
if (Settings.UseAnimation) | |
await Task.Delay(100); | |
LastQuerySelected = true; | |
break; | |
case LastQueryMode.Selected: | |
if (Settings.UseAnimation) | |
await Task.Delay(100); | |
LastQuerySelected = false; | |
break; |
case
branches, so it probably solves some old issue I don't know about.
Closes #3116. My IDE also removed a bunch of unnecessary whitespace when I edited these files. I thought it's not a big deal and that whitespace should have been removed anyway, so I didn't exclude those changes from the PR.
What it is
These changes introduce two new options to Last Query Style in settings: "Preserve Last Action Keyword" and "Select Last Action Keyword". They work just like "Preserve/Select Last Query", but only for action keywords, not for whole queries. With these options, when there is an action keyword, the next time the user opens Flow Launcher, the query is set to
keyword
(with a space after it, so the user can immediately begin typing). If the last query didn't have an action keyword, the query is set to an empty string.Testing
I've tested: