tth05 / obsidian-completr

Auto-completion plugin for the obsidian editor.
MIT License
291 stars 18 forks source link

Plugin doesn't work in one of my vaults #28

Closed Panossa closed 2 years ago

Panossa commented 2 years ago

Heyo, I just updated Obsidian after not using it for a month or something like that, updated Completr in two of my vaults and noticed it stopped working in one of them.

The Chrome/Electron console doesn't have any warning or errors from any plugin, especially none from Completr.

Creating a new file with frontmatter, then writing "tags: " opens a suggestion dialogue in one of the vaults but not the other. Pressing the hotkey for opening the suggestion dialogue works in one but not the other. Even creating a new hotkey and testing that didn't yield better results.

Tag Wrangler version: 0.5.3, Obsidian version: 0.15.8, All other plugins disabled.

Panossa commented 2 years ago

Update: PC restart (not only Obsidian) helped, no idea why.

tth05 commented 2 years ago

Very weird. Glad it works now!

Panossa commented 2 years ago

Actually, lemme just reopen that. It only ever worked after that one system restart. After I wrote my comment and closed the ticket, it stopped working when I created the next file in that vault.

And now, after a few days, I started Obsidian and still can't use Completr in that one vault. The only difference now being: if I create a new file, it stops working in ALL of my vaults.

Even if I open a brand new sandbox/help vault, install only Completr, it doesn't work.

Edit: it sounds like the plugin stops working when I create a file. That's not the case. Even if I just restart everything and open a sandbox vault, it's not working at all. I just NOTICED it after I created a new file after closing this issue.

Panossa commented 2 years ago

Update: I created a few more files and suddenly while writing a note it just started working again. But it's incredibly inconsistent. Even after a restart it works now but I'm sure it'll break soon™️

Edit: restarted Obsidian, works. Created a new file, stopped working.

tth05 commented 2 years ago

That's a really weird issue, I have no idea how to replicate it. I tried a few things and can't get it to not work. What parts of Completr are you testing that don't work? All completions or just specific providers? To test if the plugin does anything you can place your cursor at the start of the file, then open the popup and you should get a front-matter suggestion if you have that provider enabled.

Panossa commented 2 years ago

My goal is to use it with frontmatter only. Of all the toggle sliders in the Completr settings I have only enabled the front matter provider enabled (and disabled "add suffix to tag completion"). Everything else is disabled.

Opening the popup at the start of a file suggests adding front-matter like it should. But then, inside the frontmatter, it doesn't provide any suggestions for tags or aliases (or even the KEYS of the frontmatter, e.g. "tags", "sources").

Using the hotkey to open the suggestions doesn't create a warning or error in the console, either.

Panossa commented 2 years ago

Update: it fixed itself by doing absolutely nothing. After it broke last time I just kept Obsidian opened and watched a few videos in my browser. Then I switched back to Obsidian and the plugin works again.

Edit: I just noticed, it seems in the same time my spell checker (the built-in one from Obsidian) reset its settings. I've set it up to US English but it seems leaving Obsidian opened for a bit reverts the cashed settings back to default (which for me is German as my OS is in German) until I restart Obsidian. By cashed settings I mean Obsidian THINKS it needs to correct German words but if I actually open the settings it's still set to English. I hope that has nothing to do with the actual problem but I thought it wouldn't be bad to mention it.

Panossa commented 2 years ago

I think imma keep updating this with stuff so the behavior is better documented. Just started Obsidian again, created a new file, Completr wasn't working. Added some tags myself without completion, created a new line, started typing "aliases" and on the last letter or something, suddenly, the suggestions started working again.

Then I created a new file, added frontmatter, Completr was dead again. Still no errors in the console.

Edit: I just noticed Completr works in every file except the newly created file (which I mentioned above). What the actual...?

Panossa commented 2 years ago

OH MY GOD I think I found the problem! At least it's something reproduce-able!

If I create a file, Completr will suggest adding frontmatter. As long as I'm inside the frontmatter block, Completr will then stop working, UNTIL I add a line break to the last frontmatter char (-). Meaning the frontmatter needs to be "completed" by a line break for Completr to work. My newly created files all don't have multiple lines, that's why it seems to be happening.

Just to be sure I don't confuse anyone with my description:

---\n
tags: [cursor]\n
---

doesn't give me suggestions, while

---\n
tags: [cursor]\n
---\n

...does. (If \n is an actual line break - can't write those here.)

tth05 commented 2 years ago

Thanks a lot for sticking around and figuring this out. Fixed in 86ba67692db887da90e44124854a0c75114f01ed. Let me know if this fully resolves all your issues with the new version.

Panossa commented 2 years ago

My first tests are working so I'm going to close this issue until I find another problem like this. Thank you! :D