Is it possible to include a language and a theme in the same package?


#1

A little more than a year ago, I wrote a package that included a language (cson in a grammar directory) and a theme (less in a stylesheets directory). It worked briefly - for files with a particular extension, the grammar and the stylesheet loaded automatically, and for other files, it didn’t. An Atom update broke the package.

I’ve since rewritten it to work, but now, it seems I have to have two separate packages - one for the language and one for the theme; when “theme” : “syntax” is present in package.json, Atom ignores the grammar, and when it’s absent, Atom ignores the theme.

Is there any way to include both of these in the same package, or is this now impossible?

Further, with two packages, while the grammar loads correctly, but the theme only loads if I choose it explicitly; and when it is chosen, it styles all editor windows, rather than only the windows for those with the appropriate extension. Is there any way to limit the theme to the particular extension, or must it always apply to all extension?


#2

The ability to include a theme and a grammar in a single package has never been an intentional feature. I know that there has been some performance work that has been going on around how packages load and activate, this must have been some of the work that broke things.

There is some information in the atom-pane element about the file name or path that you could use to target certain tabs to try to style just them. But again, this is not a scenario that Atom explicitly supports and there may be strange alignment or other issues.