Syntax highlighting: python mislead as JS


#1

Hello everyone.
I have been running big projects in Atom since a couple of years and always found it great.
Since the last update however, it happens very often that syntax highlighting messes up.

More in detail, the usual python syntax highlight is replaced by javascript’s one, even if I don’t have any javascript file in my project.

If I close Atom and reopen it, the syntax highlighting gets fixed (most of the times).
This is not a problem of the language detector as if I check (ctrl + shift + l) python is already detected.

I am experiencing this on different laptops with different operating systems, am I the only one?


#2

This is the first time I’ve heard of that. I would check your init.coffee file to see if you have any bits of code setting the grammar on files, and check Atom when started from the command line with atom --safe.


#3

Hi @DamnedScholar thanks for getting back to me.
init.coffee is empty (actually it was never created). When opening with atom --safe the problem persists.
I am using ubuntu 18.04 and latest Atom version.


#4

Can you please provide a guide on the minimal steps to reproduce the issue? Things like file name, file contents, how you opened it, etc.

Ideally, we could follow your instructions to the letter and see the same behaviour you are.

Also, you’re using Atom v1.27.1 right? Saying “latest” seems reasonable when posting, but references like that quickly become ambiguous (plus sometimes the issue is a user hasn’t realised there’s been an update, and is still using v0.x.x; not likely here though).


#5

I open Atom either from command line or clicking on its icon and it opens on the last project I was working on.
The project contains several folders and files, among which most are python files but there are also some .txt and .pickle.

atom 1.27.1, apm 1.19.0


#6

Next time this happens, don’t do anything before you take a screenshot of the freshly open, incorrectly identified file, and you should include the expanded tree view and the status bar in this screenshot.


#7

This is the screenshot!


#8

In the lower right-hand corner, the status bar says Python. If that screenshot doesn’t look like you expect it to, what should it look like?


#9

I’m really sorry about that, I just realized that the problem was not between JS grammar and Python’s but between the one I use (MagicPython) and atom’s default for Python. Both of them were enabled and they were used randomly.

Thanks a lot for your support.


#10

Problem solved. I also use MagicPython, and I’ve found it to be the nicer language package by a good margin, so I recommend keeping the core package disabled.