Closed homocomputeris closed 6 years ago
The inspections shows up because the \begin{..}..\end{..}
shows up after the parse exception after \def\beq{\begin{equation}}
.
Currently, the parser cannot separate a \begin{..}..\end{..}
construct from the usage of \begin
or \end
in other scopes like definitions. This is a deficiency that we'd like to resolve in the future. I am not able to give an estimate for when this will be resolved.
Also tagging @stenwessel who is mainly responsible for the parser and lexer.
Yes, this is indeed the case. There is a clean workaround though for when you want to use \begin{...}
and \end{...}
in separate command definitions:
In LaTeX, \begin{foo}
is just an alias/syntactic sugar for the command \foo
. Other examples:
\begin{document}
<=> \document
\begin{figure}[h]
<=> \figure[h]
The \end{foo}
command translates to \endfoo
.
You can use these commands in your custom command definitions to prevent parse errors.
For this workaround, I am closing this issue for now, but feel free to comment if you have any further questions.
The problem is documentclass
isn't recognised either.
When you change the definitions of \beq
and \eeq
to
\def\beq{\equation}
\def\eeq{\endequation}
the snippet in your original post should not contain any syntax errors. When these are gone, TeXiFy will be able to parse your document correctly and give appropriate warnings. The cause of the documentclass/document environment not being found is because of these parse limitations.
Could you check if the warnings disappear when changing the snippet?
@stenwessel Sorry, seems that documentclass
was fixed in 0.6, and I haven't noticed the update.
Type of JetBrains IDE (IntelliJ, PyCharm, etc.) and version
PyCharm 2018.1.2 (Professional Edition) Build #PY-181.4668.75, built on April 25, 2018 JRE: 1.8.0_152-release-1136-b29 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.16.4-1-ARCH
TeXiFy IDEA version
0.5.1
What I did (steps to reproduce)
Expected behavior
Recognize
documentclass
anddocument
Actual behavior
Document doesn't contain documentclass command Document doesn't contain a document environment