Plist as XML in Atom

0

I want to open .plist files as .xml files in Atom. Whenever I open a plist it opens as "Property List (Old-Style)" which is bizarre.

I have this in my config.cson but to no avail:

"*":
  "file-types":
    h: "source.objc"
    "plist": "source.xml"

I really haven't the slightest idea why this is wrong, but it doesn't work.
(Control-Shift-L -> X -> Enter isn't bad, but...)

Dan Rosenstark

Posted 2017-02-03T04:54:39.287

Reputation: 5 718

Answers

0

Grammar Name is Misspecified

You need to change to use the name of the grammar, not the scope (no quotes necessary for the plist either):

"*":
  "file-types":
    h: "source.objc"
    plist: "text.xml"

Grammars in Atom

On this page it says how to get the grammars list:

To see all available grammars registered in your Atom instance, open the Developer Tools Console and execute the following:

console.log(Object.keys(atom.grammars.grammarsByScopeName).sort().join("\n"))

So... How do you open the Developer Tools? On Mac it's Cmd+Opt+I and then it's the right most tab (as mentioned here).

Then you'll see the grammars including the one you need, including:

text.todo
text.xml
text.xml.plist

And that's it!

Dan Rosenstark

Posted 2017-02-03T04:54:39.287

Reputation: 5 718