Repository navigation
Reconcile a default profile created before InitializeAsync with the stored profiles [patch] - #250
Open
matt-edmondson wants to merge 2 commits into
Open
matt-edmondson wants to merge 2 commits into
matt-edmondson wants to merge 2 commits into
Conversation
…tored profiles [patch] A placeholder from CreateDefaultProfile() called before InitializeAsync() now takes the stored profile's name and description, copies stored bindings as a fresh load would (duplicate chords included), and is dropped when the user deleted "default" but has other profiles stored. Fixes #247 Fixes #248 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2nqDpBsFvG1itmU1b
…ts complexity in bounds [patch] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW2nqDpBsFvG1itmU1b
|
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.



Fixes #247
Fixes #248
Both issues are gaps in the create-before-init path that #206 made supported, and their triage asked for one fix, so this PR covers both.
What changed
KeybindingManagernow remembers the profileCreateDefaultProfile()makes beforeInitializeAsync()has run, along with the name and description it gave it.InitializeAsync()then reconciles that placeholder with what is stored:CreateDefaultProfilegave it, it takes the stored profile's name and description. The nextSaveAsyncno longer writes "Default / Default keybinding profile" over the user's.MergeStoredBindingscopies stored bindings withSetStoredChord, as a fresh load does. Before, it usedSetChordand kept only the first binding per chord in file order. Legacy data that binds one chord to several commands now resolves in ordinal command-id order (a.cmdin the issue's example) and keeps both bindings on disk. In-memory bindings still take precedence: a stored binding is skipped when its command or chord is already bound in memory.CreateDefaultProfilewould have done had it run after loading. A placeholder the app has already bound or renamed is kept.This follows the triage note on #248: it reconciles inside
InitializeAsyncrather than throwing before init, so the call order #206 supports keeps working.Tests
New tests in
ProfileCreatedBeforeInitializeTests:ProfileCreatedBeforeInitialize_TakesTheStoredNameAndDescription: the rename survives a create-before-init launch, a save, and a reloadProfileCreatedBeforeInitialize_ResolvesDuplicateStoredChordsAsAFreshLoadDoes: the issue's duplicate-chord fixture resolves toa.cmdand keeps both bindings after a saveDefaultProfileCreatedBeforeInitialize_DoesNotBringBackADeletedDefault: the A "default" profile the user deleted comes back for good when CreateDefaultProfile() runs before InitializeAsync() (#189 returns on the #206 path) #248 sequence ends with onlyvim, in memory and on diskDefaultProfileCreatedBeforeInitialize_ActivatesAStoredProfileWhenItsPlaceholderIsDroppedDefaultProfileCreatedBeforeInitialize_IsKeptOnceTheAppHasBoundIt: guard test; it passes before and after the changeI reverted
KeybindingManager.csand reran the class: the first four tests fail without the fix and pass with it. The full suite passes: 439 tests, 0 failures.dotnet format --verify-no-changesis clean on the changed files.Generated by Claude Code