Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoclean the bibliographic cache data when the match string format changes #2097

Closed
xileF1337 opened this issue Jul 12, 2021 · 1 comment
Closed

Comments

@xileF1337
Copy link

xileF1337 commented Jul 12, 2021

Background

As discussed and implemented in #2095, the keys match_str_fmt, menu_fmt, and abbr_fmt of dictionary g:vimtex_complete_bib allow a customization of the match string and the displayed menu for citation completion. After the BibTeX entries of a LaTeX document were formatted according to the specified settings, the result is stored in a bibcomplete*.json cache file.

Feature suggestion

When any of the above keys' values change, the cache needs to be cleaned and regenerated to correctly reflect the updated formats. Currently, this has to be done manually by the user, who needs to call :VimtexClearCache bibcomplete. This process should be automated.

Proposed implementation

Store the values of the aforementioned keys within the bibcomplete*.json cache file. When loading the cache data, compare their current values with the values from the cache file. If any differs, clear the cache file automatically.

Note that only the cache file of the current document should to be cleaned as other cache files may already be up to date.

lervag added a commit that referenced this issue Jul 15, 2021
@lervag
Copy link
Owner

lervag commented Jul 15, 2021

Thanks, I've now pushed a change where the bibcomplete cache files are validated. If the validation fails, then the cache should be automatically cleared. I added a couple of tests, and it seems to work well. But of course, let me know if you find any bugs!

@lervag lervag closed this as completed Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants