can't get bibliography to autocomplete
larkinrt opened this issue · 9 comments
Hi, thank you for this it's super helpful. For some reason I can't get my bilbliography data to autocomplete. It is set up properly in the qmd document and compiles fine when I run quarto preview, but doesn't appear as an autocomplete. Am I missing a place to put the references file outside of the qmd doc? I am coming from doom-emacs using citar where that is indicated in the settings.
Also, "right" is misspelled using SPC-s-r, not sure if that was intentional.
Can you provide a reproducible example?
I tried reinstalling and now getting some funky errors with treesitter, so I'm pretty lost.
Edit: apparently that's an expected behavior while Mason downloads the correct things? It seems to function normally (except for the bibliography references) after giving it some time. I'll keep messing with this to see if I can figure it out.
Ok I figured it out, if I use an absolute path in the YAML data then it will work, but if I use a relative path it doesn't. I do not know why.
I am on macOS using nvim from homebrew. Maybe this is a macOS specific bug?
Ok now I really figured it out.
Adding the following to my init.lua resolved the issue. The problem was the working directory wasn't being set when files were opened, so the relative path of the .bib couldn't function (nvim was looking from the perspective of root).
vim.cmd('set autochdir')
I'm not sure if you have this enabled in your own config, but for anybody coming from the kickstarter vids without a background in vim this might be helpful to mention somewhere.
Thanks for the troubleshooting! I'll also see if the plugin can be more robust against this.
I am currently troubleshooting the same problem.
Your kickstart definitely works as intended as if I setup a 2nd nvim instance using your config it works out of the box.
However I am not quite getting to how you configured the lsp that the references work. Is there anything else that is responsible for retrieving the references/yaml highlighting? (I assume the issue is related and my setup is missing something).
I copied all the lsp related stuff almost 1:1, but I am not getting the same auto complete and the yaml is also not formatted nicely like with yours.
I am not quite sure what else to do.
For reference completion you need https://github.com/jmbuhr/cmp-pandoc-references/
For the yaml I assume you just have to install the treesitter grammar with :TSInstall yaml
and reload.
Wow I am blind. I forgot to extend my cmp sources...
Thank you so much