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

TeXiFy not able to determine correct file/lineno from error log #3847

Open
nealeyoung opened this issue Jan 9, 2025 · 6 comments
Open

TeXiFy not able to determine correct file/lineno from error log #3847

nealeyoung opened this issue Jan 9, 2025 · 6 comments
Labels
bug Deficiencies in TeXiFy behaviour.

Comments

@nealeyoung
Copy link

Type of JetBrains IDE (IntelliJ, PyCharm, etc.) and version

PyCharm 2024.1.4 (Professional Edition)
Build #PY-241.18034.82, built on June 24, 2024

Operating System

MacOS

TeXiFy IDEA version

0.9.7

What I did (steps to reproduce)

  1. compiled a latex file that had an undefined command,

  2. clicked on the error message in the "Log Messages" subsection of the console output.

Minimal example to reproduce the problem

\documentclass{article}

\setlength{\textheight}{3in}   % commenting this line out makes the problem go away

\newcommand{\filler}{
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
}
\begin{document}

    \filler

    \filler

    \filler

    \filler

    \filler

    \asd

\end{document}

Expected behavior

Pycharm should move the cursor to the line with the error.

Actual behavior

Pycharm doesn't move the cursor to the line with the error.

I'm assuming that the problem is with the parsing of the log. I'm guessing the line

[1{/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]

is somehow causing TeXiFy to lose track of the file that the error message is in. More specifically, when the log contains the following lines preceding the error, it doesn't work:

(./0_main.tex
LaTeX2e <2024-11-01> patch level 1
L3 programming layer <2024-12-25>
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2024/06/29 v1.4n Standard LaTeX document class
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(/Users/neal/Desktop/mwe/out/0_main.aux)
[1{/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
./0_main.tex:23: Undefined control sequence.
l.23     \asd

When the log contains these lines (which happens for me if all text fits on a page), it does work:

(./0_main.tex
LaTeX2e <2024-11-01> patch level 1
L3 programming layer <2024-12-25>
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2024/06/29 v1.4n Standard LaTeX document class
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(/Users/neal/Desktop/mwe/out/0_main.aux)
./0_main.tex:23: Undefined control sequence.
l.23     \asd

(if applicable) The full stacktrace of the exception thrown


@nealeyoung nealeyoung added bug Deficiencies in TeXiFy behaviour. untriaged Issue type still needs to be triaged or verified. labels Jan 9, 2025
@PHPirates
Copy link
Collaborator

Is it possible for you to update pycharm and try again with TeXiFy 0.9.9?
When I try your example, I see a correct line number, which should be line 22:

image

@PHPirates PHPirates added more-info-needed More information is needed from the person filing the issue. and removed untriaged Issue type still needs to be triaged or verified. labels Jan 10, 2025
@nealeyoung
Copy link
Author

nealeyoung commented Jan 10, 2025

I updated but still get the same error. Does your log show the following line?

[1{/usr/local/texlive/2024/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]

Or similar? It seems plausible that I am getting that log line as an artifact of my particular tex installation, in particular, because of whatever way the fonts were generated. I'm guessing it throws off the "file stack" in the part of the code that keeps track of which file each error message refers to.

Untitled 2

@nealeyoung
Copy link
Author

Here's the screenshot showing the raw output from the compilation.
Untitled 2

@PHPirates PHPirates removed the more-info-needed More information is needed from the person filing the issue. label Jan 10, 2025
@PHPirates
Copy link
Collaborator

You're right, I can reproduce the problem if I just input your log. Thanks for the example!

PHPirates added a commit that referenced this issue Jan 10, 2025
@nealeyoung
Copy link
Author

nealeyoung commented Jan 12, 2025

Meanwhile, is there any short-term fix that I can use to work around this problem with the current version?

Maybe some customizable regular expression parameter to TeXiFy that I could change?

@PHPirates
Copy link
Collaborator

No, unfortunately the problem is not as easily fixed as with a regex change. The problem is related to how we implemented live parsing of the log: line by line but with a buffer of two lines, which is problematic if the error spans 3 lines, or if we need 3 lines to determine what belongs to a file path (a line could be broken up by the default line length).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Deficiencies in TeXiFy behaviour.
Projects
None yet
Development

No branches or pull requests

2 participants