texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.83k stars 345 forks source link

Improve parsing of multiline LaTeX3 warnings/errors #1410

Closed tweh closed 8 months ago

tweh commented 3 years ago

This issue might be linked to issue #318 could be tagged “enhancement”.

Environment

Actual behavior

For longer warnings issued by LaTeX2e using \MessageBreak or by LaTeX3 package in general in the LOG file for every line except the first one the message is indented and the line starts with (<pkg>) (marked red). The latter text is then parsed by TeXstudio to be part of the message in the table view. For warnings without \MessageBreak the parsing is fine, since the format of the message in the LOG is different. txswarning tex - TeXstudio 2020-12-31 11-34-54

Expected behavior

It would be nice if TeXstudio could filter these texts (marked red) and show only the real message text without interruption.

How to reproduce

Example to test

\documentclass{article}

\newcommand{\warningIIeA}{%
   \PackageWarning{demo}{This is a quite long warning message broken in multiple lines, but the parser incorporatdes the line prefix conatining the package name.}
}
\newcommand{\warningIIeB}{%
   \PackageWarning{demo}{This is a quite long warning message broken in multiple\MessageBreak lines, but the parser incorporatdes the line prefix\MessageBreak conatining the package name.}
}

\usepackage{xparse}

\ExplSyntaxOn
\msg_new:nnnn { demo } { message } { This~is~a~quite~long~warning~message~broken~in~multiple~lines,~but~the~parser~incorporatdes~the~line~prefix~conatining~the~package~name. } { no~futher~help~... }
\NewDocumentCommand{ \warningIII } { } {
   \msg_warning:nn { demo } { message }
}
\ExplSyntaxOff

\begin{document}
\LaTeXe\ warning message \warningIIeA

\LaTeXe\ warning message with message break \warningIIeB

\LaTeX3 warning message \warningIII
\end{document}
muzimuzhi commented 3 years ago

Reproducible when using \MessageBreak in latex2e style \PackageWarning.

tweh commented 3 years ago

Thanks. I updated/generalised the title and comment.

tobiasBora commented 10 months ago

Note also that if the error message contains a long line like robustExternalize/robExt-ABC41082ADB6EF46AFE4D61D09630D7A.pdf here:

! Package robExt Error: On line 16: the pdf file
(robExt)               
robustExternalize/robExt-ABC41082ADB6EF46AFE4D61D09630D7A.pdf
(robExt)                is not present. The compilation command "cd
(robExt)                robustExternalize/ && gnuplot -c
(robExt)                "robExt-ABC41082ADB6EF46AFE4D61D09630D7A.tex" &&
(robExt)                echo "ok" >
(robExt)                "robExt-ABC41082ADB6EF46AFE4D61D09630D7A.pdf"" used
(robExt)                to compile the environment on line 16 certainly
(robExt)                failed with errors:
(robExt)                vvvvvv
(robExt)                some random message error from gnuplot
(robExt)                ^^^^^^
(robExt)                See full logs below or in
(robExt)               
robustExternalize/robExt-ABC41082ADB6EF46AFE4D61D09630D7A-compilation.log.

the error message is even worse as it will not even print anything past "On line 16: the pdf file".

--EDIT-- I tried to have a shorter file name fitting in one line, but the result is no better, I don't even see the multiple lines with the (robExt) in between sadly, only the first line:

image

Also, how are you getting the parsing the message to get the line number?