Skip to content

Conversation

01Dri
Copy link
Contributor

@01Dri 01Dri commented Oct 11, 2025

CHANGES

  • Fix an issue that when clicking history items & context items, the clicked item will be saved in history
  • Add one option to change history type (query or last opened) for display
  • Old type of the history data can be migrated
  • Clicking last opened type data will execute the action from the original plugin

@prlabeler prlabeler bot added the enhancement New feature or request label Oct 11, 2025
@github-actions github-actions bot added this to the 2.1.0 milestone Oct 11, 2025
Copy link

gitstream-cm bot commented Oct 11, 2025

🥷 Code experts: Jack251970, taooceros

Jack251970, taooceros have most 👩‍💻 activity in the files.
Jack251970, onesounds have most 🧠 knowledge in the files.

See details

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

Jack251970 taooceros
OCT
SEP 2 additions & 3 deletions
AUG
JUL 45 additions & 4 deletions 37 additions & 0 deletions
JUN 4 additions & 2 deletions
MAY 86 additions & 30 deletions

Knowledge based on git-blame:
Jack251970: 32%
onesounds: 16%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970 taooceros
OCT
SEP 14 additions & 6 deletions
AUG 4 additions & 0 deletions
JUL 48 additions & 13 deletions 22 additions & 0 deletions
JUN 21 additions & 0 deletions
MAY 33 additions & 4 deletions

Knowledge based on git-blame:
onesounds: 35%
Jack251970: 22%

Flow.Launcher/MainWindow.xaml.cs

Activity based on git-commit:

Jack251970 taooceros
OCT 4 additions & 3 deletions
SEP 90 additions & 49 deletions
AUG 0 additions & 2 deletions
JUL 57 additions & 45 deletions 83 additions & 7 deletions
JUN 91 additions & 71 deletions
MAY 145 additions & 43 deletions

Knowledge based on git-blame:
Jack251970: 65%
onesounds: 14%

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Activity based on git-commit:

Jack251970 taooceros
OCT 384 additions & 337 deletions
SEP 2 additions & 2 deletions
AUG
JUL 41 additions & 36 deletions 75 additions & 1 deletions
JUN 26 additions & 14 deletions
MAY 62 additions & 11 deletions

Knowledge based on git-blame:
Jack251970: 69%
onesounds: 17%

Flow.Launcher/Storage/HistoryItem.cs

Activity based on git-commit:

Jack251970 taooceros
OCT
SEP
AUG
JUL
JUN
MAY

Knowledge based on git-blame:

Flow.Launcher/ViewModel/MainViewModel.cs

Activity based on git-commit:

Jack251970 taooceros
OCT 1 additions & 1 deletions
SEP 13 additions & 15 deletions
AUG
JUL 30 additions & 9 deletions 344 additions & 65 deletions
JUN 25 additions & 13 deletions
MAY 529 additions & 316 deletions

Knowledge based on git-blame:
Jack251970: 35%
onesounds: 7%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

@01Dri
Copy link
Contributor Author

01Dri commented Oct 15, 2025

I decided to revert my recent changes to follow the approach that was originally planned. I tested your changes, @Jack251970 , and everything looks good!

OBS: I get your point now. When switching between styles, the same items should be shown; only the display style “HistoryStyle” and the action change.

I was thinking there would be a separation between Query items and Last Opened items. But after understanding your view better, I see it makes more sense for them to be the same items, just with a different display. Makes a lot more sense! Thanks for the review!

This comment has been minimized.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
Flow.Launcher/Storage/QueryHistory.cs (1)

42-45: Fix the off-by-one in history trimming.

With the current > _maxHistory check the list happily grows to _maxHistory + 1 entries before trimming, so the cap is never respected exactly.

-        if (LastOpenedHistoryItems.Count > _maxHistory)
+        if (LastOpenedHistoryItems.Count >= _maxHistory)
         {
             LastOpenedHistoryItems.RemoveAt(0);
         }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8d3cdf and 10d353d.

📒 Files selected for processing (5)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (3 hunks)
  • Flow.Launcher/Helper/ResultHelper.cs (1 hunks)
  • Flow.Launcher/Storage/LastOpenedHistoryItem.cs (1 hunks)
  • Flow.Launcher/Storage/QueryHistory.cs (1 hunks)
  • Flow.Launcher/ViewModel/MainViewModel.cs (16 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
Flow.Launcher/Storage/QueryHistory.cs (2)
Flow.Launcher/ViewModel/MainViewModel.cs (4)
  • List (1318-1379)
  • Query (1198-1226)
  • Result (1755-1796)
  • Result (1798-1826)
Flow.Launcher/Storage/LastOpenedHistoryItem.cs (2)
  • LastOpenedHistoryItem (6-31)
  • Equals (15-30)
Flow.Launcher/Helper/ResultHelper.cs (2)
Flow.Launcher/Storage/LastOpenedHistoryItem.cs (1)
  • LastOpenedHistoryItem (6-31)
Flow.Launcher.Core/Plugin/QueryBuilder.cs (1)
  • QueryBuilder (7-61)
Flow.Launcher/ViewModel/MainViewModel.cs (4)
Flow.Launcher/PublicAPIInstance.cs (4)
  • List (251-251)
  • List (530-530)
  • BackToQueryResults (520-520)
  • ChangeQuery (72-75)
Flow.Launcher/Storage/QueryHistory.cs (3)
  • PopulateHistoryFromLegacyHistory (21-34)
  • History (9-66)
  • Add (36-65)
Flow.Launcher/Storage/LastOpenedHistoryItem.cs (1)
  • LastOpenedHistoryItem (6-31)
Flow.Launcher/Helper/ResultHelper.cs (1)
  • ResultHelper (12-44)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build

@Jack251970 Jack251970 requested a review from Copilot October 15, 2025 04:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

This comment has been minimized.

Added logic to record user-selected results in `_userSelectedRecord`
before executing both synchronous and asynchronous actions. This
enables tracking of user interactions for result ranking or analytics.
Comments were added to clarify the purpose of the new logic.
@Jack251970 Jack251970 requested a review from Copilot October 15, 2025 04:26
Moved `_userSelectedRecord.Add(result)` outside the `if (queryResultsSelected)` block to ensure all user-selected results are recorded, regardless of their source (query results, context menu, or history). Added a comment to clarify that only query results are added to history.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
Flow.Launcher/ViewModel/MainViewModel.cs (1)

1317-1384: Consider preserving the original subtitle for Last Opened history.

For HistoryStyle.Query (lines 1324-1339), showing only the timestamp as subtitle makes sense. However, for Last Opened history (lines 1343-1382), line 1350 replaces the subtitle with just the timestamp, discarding h.SubTitle which often contains important metadata like file paths or descriptions. This breaks fuzzy search on subtitle and makes it harder to distinguish items with identical titles.

Apply this diff to preserve the subtitle while still showing the timestamp:

                     var result = new Result
                     {
                         Title = string.IsNullOrEmpty(h.Title) ?  // Old migrated history items have no title
                             Localize.executeQuery(h.Query) :
                             h.Title,
-                        SubTitle = Localize.lastExecuteTime(h.ExecutedDateTime),
+                        SubTitle = string.IsNullOrEmpty(h.SubTitle) 
+                            ? Localize.lastExecuteTime(h.ExecutedDateTime)
+                            : $"{h.SubTitle} • {Localize.lastExecuteTime(h.ExecutedDateTime)}",
                         IcoPath = Constant.HistoryIcon,

This preserves searchability while still surfacing when the item was last opened.

Note: The rest of the Last Opened implementation is solid:

  • Line 1355: Correctly re-queries the plugin to get the fresh result and its action
  • Lines 1358-1370: Properly handles both sync and async actions
  • Lines 1373-1376: Good fallback when the result is no longer available
  • Line 1347-1349: Appropriate fallback for migrated legacy items
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 10d353d and 4b6ee4e.

📒 Files selected for processing (1)
  • Flow.Launcher/ViewModel/MainViewModel.cs (15 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
Flow.Launcher/ViewModel/MainViewModel.cs (5)
Flow.Launcher/PublicAPIInstance.cs (4)
  • List (251-251)
  • List (530-530)
  • BackToQueryResults (520-520)
  • ChangeQuery (72-75)
Flow.Launcher.Infrastructure/Helper.cs (1)
  • Helper (7-31)
Flow.Launcher/Storage/QueryHistory.cs (3)
  • PopulateHistoryFromLegacyHistory (21-34)
  • History (9-66)
  • Add (36-65)
Flow.Launcher/Storage/LastOpenedHistoryItem.cs (1)
  • LastOpenedHistoryItem (6-31)
Flow.Launcher/Helper/ResultHelper.cs (1)
  • ResultHelper (12-44)
🪛 GitHub Actions: Check Spelling
Flow.Launcher/ViewModel/MainViewModel.cs

[warning] 27-27: Spell check warning: 'NKORE' is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (6)
Flow.Launcher/ViewModel/MainViewModel.cs (6)

155-155: LGTM!

The migration call is correctly placed after loading history and will migrate legacy HistoryItem entries to the new LastOpenedHistoryItem format.


357-357: LGTM!

The history API has been correctly updated to use LastOpenedHistoryItems throughout. Index bounds are properly validated before access using the index-from-end operator.

Also applies to: 385-393, 399-407, 614-618


494-495: LGTM!

Caching the queryResultsSelected flag before executing the action is correct, as the action execution might navigate away from query results. The updated History.Add(result) API correctly passes the full result object to store title, subtitle, plugin ID, and record key.

Also applies to: 535-540


1273-1284: LGTM!

The context menu query logic has been reformatted for better readability without changing functionality.


1613-1613: LGTM!

Correctly retrieves the most recent history items using LastOpenedHistoryItems and reverses the order to display them with the most recent first.


12-12: No action required: using System.Windows.Input; is required by KeyGestureConverter, KeyGesture and Keyboard.Focus.

The tooltip text for the key `historyStyleTooltip` was updated to improve capitalization and consistency. "History" and "Home Page" were capitalized to align with the formatting of other keys in the file.
@Jack251970
Copy link
Member

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <[email protected]>
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

♻️ Duplicate comments (1)
Flow.Launcher/ViewModel/MainViewModel.cs (1)

1353-1353: Preserve original subtitle for searchability and context.

Setting SubTitle = Localize.lastExecuteTime(h.ExecutedDateTime) discards the stored h.SubTitle (e.g., file path, plugin info), making it impossible to search by that metadata or distinguish between identically titled entries. Consider combining both pieces of information.

This is similar to a previously flagged concern. If this design is intentional, please clarify the reasoning.

Apply this diff to preserve the original subtitle:

-                        SubTitle = Localize.lastExecuteTime(h.ExecutedDateTime),
+                        SubTitle = string.IsNullOrEmpty(h.SubTitle) 
+                            ? Localize.lastExecuteTime(h.ExecutedDateTime)
+                            : $"{h.SubTitle} • {Localize.lastExecuteTime(h.ExecutedDateTime)}",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b6ee4e and b784a14.

📒 Files selected for processing (5)
  • Directory.Build.props (1 hunks)
  • Flow.Launcher/Flow.Launcher.csproj (1 hunks)
  • Flow.Launcher/Languages/en.xaml (1 hunks)
  • Flow.Launcher/MainWindow.xaml.cs (3 hunks)
  • Flow.Launcher/ViewModel/MainViewModel.cs (15 hunks)
✅ Files skipped from review due to trivial changes (2)
  • Flow.Launcher/Flow.Launcher.csproj
  • Directory.Build.props
🚧 Files skipped from review as they are similar to previous changes (2)
  • Flow.Launcher/MainWindow.xaml.cs
  • Flow.Launcher/Languages/en.xaml
🧰 Additional context used
🧬 Code graph analysis (1)
Flow.Launcher/ViewModel/MainViewModel.cs (4)
Flow.Launcher/Storage/QueryHistory.cs (3)
  • PopulateHistoryFromLegacyHistory (21-34)
  • History (9-66)
  • Add (36-65)
Flow.Launcher.Plugin/Result.cs (2)
  • Result (13-374)
  • Result (293-327)
Flow.Launcher/Storage/LastOpenedHistoryItem.cs (1)
  • LastOpenedHistoryItem (6-31)
Flow.Launcher/Helper/ResultHelper.cs (1)
  • ResultHelper (12-44)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build

Updated the `catch` block in the `ResultHelper` class to explicitly catch `System.Exception` and log the error using `App.API.LogException`. The log includes the class name, a failure message for querying results, and the exception details. This improves error visibility and debugging.
@Jack251970 Jack251970 requested a review from Copilot October 15, 2025 04:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@Jack251970 Jack251970 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for your contribution!

@Jack251970 Jack251970 enabled auto-merge October 15, 2025 04:47
@Jack251970 Jack251970 merged commit 3d9ef2c into Flow-Launcher:dev Oct 15, 2025
5 checks passed
@jjw24 jjw24 removed the bug Something isn't working label Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] "Last opened" history mode

3 participants