Repository navigation
feat(run): ask for the current note before a choice that uses it - #21
Merged
Merged
Conversation
QuickAdd takes the current note from Obsidian's active tab, so a run started from Raycast used whatever tab was open. A choice whose currentNote is optional or required now shows a note picker first and the run gets current=<path> or current=none. Quicklinks ask the same way. The capture commands refuse a required choice and run an optional one with current=none. The choice list, Quicklinks, and the capture commands now use the list that ensureVaultReady already fetched, so they decide from a fresh currentNote instead of a cached list.
Two fixtures: a capture to the current note, and a capture with an
optional append link and {{LINKCURRENT}}. The script runs them with
current=<path> and current=none while another note is the open tab.
The note pick happens after the vault-open relaunch, so carrying a pick through the deeplink context had no caller.
A choice that does not ask for a note still ran with QuickAdd's active tab as
its current note, so a selection there could fill {{VALUE}} silently. Every
run now sends the pick or none; a QuickAdd without currentNote gets nothing.
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.
Why
QuickAdd takes the current note from Obsidian's active tab. A run started from Raycast therefore used whatever tab was open, and "append link" wrote links into random notes (#20). The extension now asks for the note and passes it with
current=, so QuickAdd never reads the active tab for that run.What changed
currentNoteisoptionalorrequiredshows a searchable note picker before Run and before a Quicklink run. An optional choice lists No current note first. The run getscurrent=<path>orcurrent=none.requiredchoice with a message that points to Run QuickAdd Choice. They run anoptionalone withcurrent=none.ensureVaultReadyalready fetches. The cached list is gone, so the decision never comes from a stalecurrentNote.Scope
current=, because there the active tab is the user's choice.current=(chhoumann/quickaddfeat/cli-current-note). The docs say 2.33, the next minor after the 2.32.0 release branch. Older QuickAdd sends nocurrentNote, so nothing changes for it.Verification
npm run e2e:protocolagainst the plugin branch build: all 19 cases pass. New cases covercurrent=<path>,current=none, thecurrentNotelabels, and a decoy note that stays open in the active tab and is never written.Output/Current.mdwrote- current: from raycastinto it, from a Quicklink and from the list. The optional capture listed No current note first, and choosing it wrote- linked: no notewith no link.npm run lint,npm test(87 passed),npx tsc --noEmit,npm run buildpass.