Feature/history#63
Draft
Testudinidae wants to merge 8 commits intoDaydreamer-riri:mainfrom
Draft
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
8710016 to
12916e0
Compare
c880c1e to
3dfac7f
Compare
…re logical flow and consistent UX.
2594424 to
a4b6d63
Compare
…ry for a specific shortcut
…ory-to-suggestions ratio, plus per-shortcut controls to enable or disable saving history
a4b6d63 to
75e9e28
Compare
cc45dc1 to
2660406
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds “History” and “Histroy × Suggestions” capabilities , and provides several tuning options to control the ratio and display caps of history vs. suggestions in the list. It also adds single-entry deletion and one-click purge of all history for a specific shortcut.
What was done
Save search history
RecordHistory).HistoryEntry/HistoryStorage/HistoryServiceto encapsulate data structures, serialization, and file I/O.Show history and suggestions together
ItemIntegrateto merge Primary / History / Suggestions, de-duplicate, and trim the list according to settings.Delete history
Settings
MaxDisplayCount(maximum number of items shown) andMaxHistoryDisplayCount(maximum number of history items shown).RecordHistory(whether to record search history for that shortcut).UI updates
User impact (behavior changes)
MaxHistoryDisplayCount.RecordHistory: false).IntSetting and TextSetting label behavior
Because
Microsoft.CommandPalette.Extensions.Toolkitdoes not includeIntSetting, I implemented one modeled afterTextSetting. I discovered thatTextSetting’sLabelis not used at all (it does not render in the UI), and I don’t know why it was designed that way. For consistency,IntSettingpreserves the same “feature.” If you notice that the label does not appear, this is a feature, not a bug.History retention / auto-deletion
I did not add automatic history deletion. In testing, even with 1M records there was no user-facing performance impact. If retention limits or auto-pruning are still desired, I can add them in a follow-up PR.
Behavior when
RecordHistoryis turned offTurning off
RecordHistorydoes not delete existing history, and I believe it should remain this way. History is keyed by the shortcut’sName. Even if we introduce anIdin the future, I don’t think we should rebind toId; multiple shortcuts with the same name sharing history is expected behavior. Therefore, if one of several same-name shortcuts disablesRecordHistory, auto-clearing the shared history would be unexpected. If users want to remove history, they can do so via the shortcut’s More commands.Renaming shortcuts and potential “ghost” history
If a shortcut is renamed, it can produce ghost history entries that remain in
History.jsonbut are no longer surfaced in the UI and cannot be deleted from there. This does not affect functionality, but it’s a privacy concern. I propose addressing it in a future PR.Naming and persistence files — please double-check
The functionality is complete, but this PR is submitted as Draft because it will persist the following settings/files. Once released, renaming would be very troublesome, so please carefully consider whether these names are appropriate:
settings.jsonWebSearchShortcut.MaxDisplayCountWebSearchShortcut.MaxHistoryDisplayCountWebSearchShortcut.jsonRecordHistory(bool)New file
WebSearchShortcut_history.json(stores search history; fields:Query,Timestamp)Please provide feedback on:
WebSearchShortcut.and its casing are consistent with existing settings.Other projects use forms like
websearch,timeDate.MaxDisplayCount,MaxHistoryDisplayCount) are clear.RecordHistoryis clear.WebSearchShortcut_history.jsonis clear, or if it should beWebSearchShortcut_History.json.WebSearchShortcut_history.jsonshould use field namesQueryandTimestamp(as in this PR) vs. aligning with thewebsearchproject’sSearchString+Timestamp.