Set installed syntax to be default syntax for file type


I’m pretty new to Atom (long time Sublime user/developer), and I’m trying to port Python Improved to Atom. I created a .tmbundle and converted it to an Atom package using apm without any issues. However, in the README, I’d like to give instructions on how to set Python Improved as the default Python syntax — that is, whenever a user opens a .py file, the syntax is automatically set to Python Improved.

I’ve read through numerous issues, pull requests, and forum posts in search of an answer, but most of what I found was related to adding a new file type to an existing syntax — for example, adding a custom extension like .xyz to an existing syntax like PHP. That’s not what I want to do. Both Python Improved and the standard Python syntax use the base scope source.python, so I can’t just do:

      'source.python': [

So, how do I set Python Improved to be the default Python syntax, and allow users to change to another syntax if they wish?


I think this is the source of the problem. If you changed the base scope of Python Improved to something different like source.python.improved or source.python-improved then you could differentiate between the two. As for making it “the default Python syntax” that’s up to the user of Atom to choose.


Right, and that’s exactly what I want to figure out how to do, so I can describe it in the README. I’m not interested in packaging Python Improved so that it automatically becomes the default Python syntax, I want the user to make that decision. Does that require changing the base scope, or is there another way?


That would require changing the base scope, yes. Otherwise how is Atom supposed to know what you mean by the customFileTypes snippet you posted above?


Okay, I think I got it. I’ll just change the base scope to source.python.improved so that snippets, color themes, etc. will still detect source.python. Thanks!