Sublime Forum

Some times ST does not recognize .tex files

#1

Occasionally I open a .tex in SM but it is not recognized as such: syntax coloring is off and cmd+B does not build and returns an error in the first line of the file. But if I just save the file it is then recognized as .tex. On those instances that this problem happens, quitting and relaunching SM does not help. I have not figured a reproducible trigger, the behavior is infrequent, but it has happened several times already. Has anyone else seen this?

0 Likes

#2

I assume you mean ST, not SM. Does it happen in safe mode?

0 Likes

#3

I meant ST… for reasons that I don’t understand S"M" comes easier to me…

The problem is that the behavior is intermittent and I cannot trigger it on purpose. Right now, for example I am not experiencing this even though ST was running continuously since the last time I encountered the behavior.

0 Likes

#4

Do you have AutoSetSyntax or any related package installed, which might fail to set syntax?

0 Likes

#5

OK, so now I have a better picture of what is going on, but not why:

  1. I close all ST tabs, quit ST, then double-click on a latex file, say 1.tex: the file always opens without syntax coloring.

  2. If I keep opening tex files one after another, they open without syntax coloring, until suddenly one opens in color. After that everything opens in color. I can also restore color by simply clicking on a file w/o coloring and saving that window.

  3. If I quit ST with a tab that contains a tex file with syntax coloring, next time I open any other tex file coloring is on. But if ST has no tab with a file in syntax coloring when it launches, it opens files without syntax coloring.

In safe mode syntax coloring always works. I have the following packages: LateX-cwl, LaTeX Tools and Package Control.

How should I go about figuring this?

0 Likes

#6

LaTeX Tools has some modules which mess with syntaxes, I’d blame.

Maybe try to set "latextools_set_syntax": false in LaTeXTools.sublime-settings

0 Likes

#7

I finally identified the problem: it is file Diff.sublime-settings in ~/Library/Application Support/Sublime Text/Packages/User which contains

{
	"extensions":
	[
		"tex"
	]
}

Removing this file restored all syntax coloring. I don’t remember creating it, is it safe to permanently remove it?

[EDIT] I ended up uninstalling and reinstalling LaTeX tools. So far behavior is normal.

0 Likes

#8

Yes, you can safely remove it. It’s created by “Always open file with … > Syntax”

0 Likes