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

No completions for commands defined in another file #52

Open
Glitzy3033 opened this issue Nov 24, 2022 · 1 comment
Open

No completions for commands defined in another file #52

Glitzy3033 opened this issue Nov 24, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@Glitzy3033
Copy link

Greetings. Suppose I have two LaTeX files called main.tex and macro.tex in the same directory. Suppose macro.tex reads:

% !TeX root = main.tex
\newcommand{\hellohello}{\mathrm{hello}}

and it is included in main.tex:

\documentclass{article}
\input{macro.tex}
\begin{document}

...

\end{document}

An expected behavior is that when one starts to type \helloh... in main.tex, a completion should pop up. But the actual behavior is that no such completion is suggested by digestif. It seems that digestif does not find the commands defined in the included files.

@astoff
Copy link
Owner

astoff commented Nov 28, 2022

It would be nice to fix this limitation, but this behavior stems from an important optimization tradeoff.

Currently, if main.tex includes, say, chapter1.tex and chapter2.tex, we pretend that any new commands or packages or further \inputs in chapter1.tex don't affect the way main.tex or chapter2.tex are parsed. This is not how TeX actually works, but it allows us not to reparse chapter2.tex if chapter1.tex changes. In this way, we can deal with documents of essentially arbitrary length as long as they are in the usual one-file-per-chapter model.

There are some even worse consequences of this optimization: If you move all your preamble to a sty file like this:

\documentclass{article}
\usepackage{mystyle}
\begin{document}
\include{chapter1}
\include{chapter2}
\end{document}

then Digesitf will not "see" any packages loaded in mystyle.sty.

@astoff astoff added the enhancement New feature or request label Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants