latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.54k stars 52 forks source link

Wrong file built in a directory with multiple main files #757

Closed haoming-li-ling closed 1 year ago

haoming-li-ling commented 2 years ago

As in the title. If there are many main files in the same directory, running TexlabBuild on one of the files could result in one or more different files being built; the file actually open may or may not get built. I know it's probably not good practice to keep multipole main files in the same directory, but still this doesn't seem to be the desired behavior.

pfoerster commented 2 years ago

Thanks for the report. This one is a bit difficult to diagnose. I have a few questions:

haoming-li-ling commented 2 years ago
haoming-li-ling commented 2 years ago

I think the shared .bib file can be the problem. I tried building multiple main files in another directory where the files don't share a .bib file, nothing surprising happens.

pfoerster commented 2 years ago

I think the shared .bib file can be the problem.

@Doltonius Yeah, this can definitely be a problem for texlab. Due to the way, the current algorithm works, all files are thrown together into one "project". That's why, the selection of the root file is arbitrary in this case.

I am currently working on a fix but this might take some more time.