[Obsidian] Add Exact Content Match Navigation - #30150
Conversation
- show each exact content occurrence as a separate search result - display highlighted context with line and column information - open and select matches through the Obsidian CLI - filter out fuzzy-only candidates without literal matches - preserve existing primary-action preferences
|
Thank you for your first contribution! 🎉 🔔 @marcjulianschwarz @KevinBatdorf @iancanderson @pernielsentikaer @ofalvai @AdamAdamsMusic @FServais @rakoort @MuuNU @theherk @vicampuzano @ErBlack @byheaven @tofrankie @alexibuild you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. 📋 Quick checkout commandsBRANCH="main"
FORK_URL="https://github.com/SWHL/extensions.git"
EXTENSION_NAME="obsidian"
REPO_NAME="extensions"
git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run devWe're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days. |
Greptile SummaryThe PR adds per-occurrence exact-content search results and Obsidian CLI navigation while retaining regular note-result behavior.
Confidence Score: 3/5The PR does not yet appear safe to merge because exact-match coordinates can be wrong for length-changing Unicode case mappings and stale asynchronous searches can replace current results. Exact matching still applies offsets from locale-lowercased strings to original note content, while the list search still lacks request ownership or cancellation after asynchronous work starts; these leave both previously reported user-visible failures reachable. Files Needing Attention: extensions/obsidian/src/api/search/content-match.service.ts; extensions/obsidian/src/components/NoteList/NoteList.tsx Important Files Changed
Reviews (2): Last reviewed commit: "fix(obsidian): preserve search coordinat..." | Re-trigger Greptile |
| if (offset === -1) break; | ||
|
|
||
| const start = positionAt(content, offset); | ||
| const end = positionAt(content, offset + trimmedQuery.length); |
There was a problem hiding this comment.
Transformed offsets select wrong text
When locale-sensitive lowercasing changes a Unicode string's UTF-16 length, indexOf returns an offset into the transformed content that is then applied to the original note. This produces incorrect preview highlighting and selects the wrong range in Obsidian; advancing by the original query length also omits or duplicates subsequent occurrences.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/obsidian/src/api/search/content-match.service.ts
Line: 57-60
Comment:
**Transformed offsets select wrong text**
When locale-sensitive lowercasing changes a Unicode string's UTF-16 length, `indexOf` returns an offset into the transformed content that is then applied to the original note. This produces incorrect preview highlighting and selects the wrong range in Obsidian; advancing by the original query length also omits or duplicates subsequent occurrences.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| setFilteredResults(sorted.slice(0, MAX_RENDERED_NOTES)); | ||
| } finally { | ||
| setIsSearching(false); |
There was a problem hiding this comment.
Superseded searches overwrite current results
If the user changes the query or sort order while a content search is reading notes, an older request can finish later and unconditionally replace the current results and clear the shared loading state. The list then exposes stale notes for opening or deletion while the latest search is still running.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/obsidian/src/components/NoteList/NoteList.tsx
Line: 89-91
Comment:
**Superseded searches overwrite current results**
If the user changes the query or sort order while a content search is reading notes, an older request can finish later and unconditionally replace the current results and clear the shared loading state. The list then exposes stale notes for opening or deletion while the latest search is still running.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Description
Enhances the existing Obsidian Search Note command with exact content-match results and navigation.
Navigation mechanism
When opening a content match, the extension:
obsidian://URI mechanism. This launches Obsidian when it is not already running.workspace.layoutReadyconfirms that workspace initialization has completed.evalcommand.Readiness and activation checks use bounded exponential backoff, and the entire navigation operation is limited to 15 seconds. Permanent CLI errors fail immediately. The extension does not create a persistent process, listener, or background service; all activity stops after successful positioning, an unrecoverable error, or timeout.
The Raycast window closes concurrently with navigation, so the user is taken to Obsidian immediately instead of waiting for workspace initialization and positioning to finish.
Title-only search and regular note results remain unchanged. Search results and match previews work without the Obsidian CLI. Exact navigation requires Obsidian 1.12.7 or later with Settings > General > Advanced > Command line interface enabled.
This implementation was developed with coding assistance from GPT-5.6. The generated changes were manually reviewed, refined, tested, and verified before submission.
Screencast
Verification
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare located outside the metadata folder if they were not generated with our metadata tool