LaTeX-Box-Team/LaTeX-Box

label completion hangs infinitely when using included files

ThomasFeher opened this issue · 0 comments

To reproduce create 2 files:
example.tex:

\documentclass{book}
\begin{document}

\section{test1}
\label{sec:test1}

\include{example2}
\end{document}

example2.tex:

%! TEX root = example.tex
\subsubsection{test2}
\label{sec:test2}

When using label completion in the first file (maybe in the second too) like typing \ref{C-x,C-o vim hangs completely.

It seems that the problem is the line

silent execute '1sp +let\ labels=s:ExtractLabels()|let\ inputs=s:ExtractInputs()|quit! ' . fnameescape(a:file)

The ExtractInputs functions calls LaTexBox_kpsewhich which in turn calls LaTexBox_GetTexRoot, which calls LaTexBox_GetMainTexFile in an aux-file buffer.
This failes and a prompt is opened to manually input the main tex file which is hidden due to the silent call.