epwalsh / epwalsh/obsidian.nvim
Search and completion should use note buffers as the source of truth over filesystem
- Dominant language
- Lua
- Stars
- 6.2k
- Forks
- 250
- PR merge metrics
- No merged PRs in 30d
Description
### 🚀 The feature, motivation and pitch
Similar to how a language server would work. I think this would be pretty straight-forward to implement 80% of the way for *completion*, but *search* would be much more involved since we rely on shelling out to `ripgrep`. Therefore we'd probably need to run the search *in Lua* over buffers concurrently with `ripgrep` over the filesystem. I'm not too concerned about performance here since most people aren't likely to have a zillion buffers open, but if we hit a bottleneck we could use the nifty `ThreadPoolExecutor` that's currently sitting unused.
### Alternatives
1. Do nothing, nobody has complained yet anyway. And users can have obsidian.nvim autowrite buffers using the callback system: https://github.com/epwalsh/obsidian.nvim/discussions/481.
2. Wait until we can integrate with [`markdown-oxide`](https://github.com/Feel-ix-343/markdown-oxide), or some other Obsidian-style markdown LS.
### Additional context
- Buffer/filesystem mismatch is *not* an issue with `:ObsidianRename` since we write all buffers before doing the grunt work there, but it would nice if that wasn't a requirement, in which case we'd have to loop over open buffers and do the rename there instead of in the filesystem.
- We'd have to update picker integrations, in particular the previews, so that we show previews of buffers instead of files to avoid out-of-sync issues there.
Contributor guide
Research direction
Start by tracing the completion and search entry points, including the ripgrep invocation and picker integrations mentioned in the issue. Review how open note buffers and filesystem files are currently read, then define completion, search, rename, and preview behavior that consistently treats buffers as the source of truth.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- developer-experience, search, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100