obsidian.nvim icon indicating copy to clipboard operation
obsidian.nvim copied to clipboard

Nvim-Cmp note [[linking]] completions freeze for 2 seconds on trigger

Open GitMurf opened this issue 1 year ago • 0 comments

🐛 Describe the bug

Not sure the best way to report this / ask the question but thought it would be easiest to link to the lines of code. The problem is that nvim-cmp completions are slow for me to load (take 2 seconds each time I trigger a completion with “[[…” for linking to notes.

I traced it down to the search.search_async() call (see below) which got me to thinking, why is [[note linking]] searching the content of all files in my vault?

As you can see below, it first runs the search.search_ansync() and then runs the search.find_async() below it.

When I comment out the search.search_async() (and add one to the cmd counter) everything works as expected and I can [[link to notes…]] quickly and without any delay/pause.

Is this expected to be searching content of notes every time even though I am just trying to link to note names?

https://github.com/epwalsh/obsidian.nvim/blob/14e0427bef6c55da0d63f9a313fd9941be3a2479/lua/cmp_obsidian.lua#L302

https://github.com/epwalsh/obsidian.nvim/blob/14e0427bef6c55da0d63f9a313fd9941be3a2479/lua/obsidian/client.lua#L463

https://github.com/epwalsh/obsidian.nvim/blob/14e0427bef6c55da0d63f9a313fd9941be3a2479/lua/obsidian/client.lua#L470

https://github.com/epwalsh/obsidian.nvim/blob/14e0427bef6c55da0d63f9a313fd9941be3a2479/lua/obsidian/client.lua#L388

https://github.com/epwalsh/obsidian.nvim/blob/14e0427bef6c55da0d63f9a313fd9941be3a2479/lua/obsidian/client.lua#L416

https://github.com/epwalsh/obsidian.nvim/blob/14e0427bef6c55da0d63f9a313fd9941be3a2479/lua/obsidian/client.lua#L424

Config

Using defaults…

Environment

nvim stable v0.10 (reporting on my phone right now… can provide later if needed but it should be N/A to my reported issue)

GitMurf avatar Aug 09 '24 02:08 GitMurf