Closed PierreMarchand20 closed 5 years ago
Completion be it for \cite
\ref
or commands is not linked to a particular root file. Changing this would require to completely redesign how completion works.
However, you should only get completions from files related to the open editors. In your example, it means that even you load a workspace with Article1
and Article2
but you only open main1.tex
then you will not get suggestions from main2.tex
and biblio2.bib
. There is no mechanism to forget completions from a file that has been closed, you need to reload vscode
.
Ok, I though that, since we are already defining root file with magic comment in all the files, we could do that if we only added another magic comment in the root file to define the folder containing the .bib
files.
Besides there already exists the option to add an additional bib file. The only thing is that we want to define it automatically using something like % !TEX bib = path
and we want to only look in this additional file.
FYI I used this feature when I was using Atom and this package https://github.com/Aerijo/autocomplete-latex#enable-citation-completions.
If I understand well, your problem only happens when you work on two different articles at the same time otherwise it is enough to only keep files related to the right article in open editors.
Yes I guess, but it also means we need to close all the pane related to the first article and reload vscode each time we want to work on another latex project. But I see your point, it may not be a critical feature.
Actually I thought something similar or close was already possible.
It used to work at the beginning but it seems that with the last updates, it does not work anymore. When looking for citations, most of references suggested are local but not all of them.
@PierreMarchand20 Please open a new issue and describe precisely the problem. Ideally, could you provide a minimal working example?
Well the issue is the same, I will try to provide a MWE.
OK I already have a MWE. I will look at it
Oh really ? I tried to a simple example, but it worked without any issue :-/ The only thing strange I saw is that the hyperlinks toward the references from other latex documents actually work. Which is a little bit inconsistent.
How did you do it ?
In the end, I have not been able to reproduce the issue. I had mixed up things in my non-MWE. Let us close the issue for now.
Do you know how can I reset intellisense manually for latex ? I tried everything as you said at the beginning, close all panes, restart vscode and so on, and I still get bib references from other .bib files. The issue is that then I have a lot of duplicates (see below)
Or at least, do you know how I could debug it ?
PS: Oh I just noticed you work at Laboratory Jean Kuntzmann, I worked there for 6 months with Eric Blayo a few years ago, small world :-)
tiny world indeed ;-)
Bib entries are stored in a map indexed by the .bib
filename and for each filename the keys must be unique. From your screenshot, I deduce that you have several .bib
files providing the same keys. Each .bib
file is associated to a list of rootFiles and intellisense should be triggered accordingly.
To try debugging all this, could you post all the logs from the extension (Output Panel / LaTeX Workshop)? I will investigate this in details.
For some reasons, I cleared the output, restarted everything and now it works. If I am able to reproduce the error, or if it appears again, I will drop the output here.
Ok, the issue reappeared this morning... I cannot see what makes it appear like that. Here's my log below, but since my workspace contains all my TeX files, it is quite big... I know for sure that this issue appears in the files in **/Doctorat/Thesis/ (see figure below). Actually, when I click on the hyperlink associated with "Ainsworth1999", I get the bib file in **/Articles/geneo_for_hypersingular/ so I think something is wrong anyway.
@PierreMarchand20 investigating the logs is quite tedious and so far I cannot understand what is going wrong. It would really help if I could reproduce the issue. Could you provide a tarball of all your tex + bib files? Of course you can remove everything but the \input
& co directives along with everything related to bibliography. You may prefer to send this to me by mail. I know this is quite a tough work to provide the tarball but I am afraid I cannot help without reproducing the issue myself. Let me know how we can proceed.
Is your feature request related to a problem? Please describe. I have one workspace with all my latex projects in separate folders, each one has its own
.bib
file. My issue is that when I use\cite
, the autocompletion suggests references from all my.bib
files, even coming from other projects (meaning, other folders). Even worse, I get duplicate if I used the reference in two different folders. For example,in
main2.tex
, it would suggest references frombiblio1.tex
.Describe the solution you'd like I would like to be able to associate to the root file, one folder where to look for
.bib
files.Describe alternatives you've considered I could use one workspace for each latex project, but I like to have all my latex projects in the same git repo and I use https://github.com/alefragnani/vscode-project-manager to generate vscode projects according to git repo.
Additional context Example of issue I get :