area/language-latex

LaTeX source is not being highlighted

Opened this issue · 7 comments

Prerequisites

  • Put an X in this box if you have done the following:
    • Ensured the issue has not already been raised
    • Ensured the issue is caused by this package

I ensured that the issue is caused by this package because I disabled all other non-core packages.

Description

Steps to reproduce & Minimum working example

  1. Open a LaTeX file
  2. Look at the source code

Example minimal LaTeX:

\ref{alg}

And really any other LaTeX source.

Expected behaviour

The LaTeX source code should be highlighted.

Actual behaviour

The LaTeX source code is not highlighted.

Additional information

I don't have any configuration pertaining to language-latex. Not sure what is causing this. This is on Atom 1.28.2 x64 on Ubuntu with language-latex 1.2.0.

I am experiencing the same behaviour on Atom 1.24.0 x64 on Ubuntu with language-latex 1.2.0

@dionyziz @hotfx

  • In the bottom right area of the status bar, what is the declared language? (It should say LaTeX, but I'm expecting it to say Plain Text if the text looks blank)

  • Can you select LaTeX in the grammar selection menu (Grammar selector: show in command palette)?

  • If you open dev tools (Window: Toggle dev tools in command palette), what does running the following return?

atom.packages.getActivePackage('language-latex')

Thanks, the Grammar selector did the trick for me.

Running the command outputs a package.

@hotfx Ahh, no, that was just to see if it was being loaded (if it wasn't, it would have returned undefined).

As for the cause, I'm not sure. It could be some faulty cache somewhere.

  • Does it happen to all .tex files, or just a particular group?
  • If you make a new one called foo.tex and save it, is it applied?
  • When you override with the grammar selector, does closing the file and opening it again work as it should?

Also try restarting Atom. Sometimes that can fix weird bugs. There's also a "nuclear option" to open Atom using atom --clear-window-state, but be careful because this will wipe all unsaved changes. I don't know if it will fix it, but it might.

  • After setting it with the grammar selector it works with foo.tex as well.
  • Opening and closing works as expected after the override

I definitely tried restarting Atom before I knew about the grammar selector and it did not work then.

After reinstalling the language-latex package, the error occurred again and was fixed by running atom --clear-window-state

  • The bottom right area says "Plain text"
  • It happens to all the files I have tried, across 3 different projects that I tested
  • Selecting the LaTeX grammar or changing the bottom right declared language to LaTeX fixes the highlighting issue. However, I have to do this manually every time I open a new file.
  • If I close and reopen a file for which I've changed the grammar to LaTeX, it remains highlighted correctly.
  • Running atom.packages.getActivePackage('language-latex') returns the package.
  • Making a new file applies the LaTeX language and highlights correctly.

atom --clear-window-state fixed the issue. Do you know why it appeared? Can we prevent it from appearing again in the future to other users?