Using customFileTypes to highlight .rules as xtend


#1

Hi there,

i´m trying to highlight my .rules files from openHAB as xtend.
I tried to use the customFileTypes in my config.cson.

customFileTypes: 'source.xtend': ['rules', 'sitemap']

But that´s not working…

Any ideas?

Thanks!


#2

Can you post the actual text of your config.cson? If you’re formatting the text the way you wrote it in your post, that would be the problem. You have to format it the way it shows in the Atom Flight Manual:

'*':
  core:
    customFileTypes:
      'source.coffee': [
        'foo'
      ]

And regarding your question in the Issue you opened, single-quotes or double-quotes don’t matter.


#3

I used the formatting that is shown in your example: How do I make Atom recognize a file with extension X as language Y?

custonFileTypes:
'source.xtend': ['rules', 'sitemap']

Or does it have to be:

custonFileTypes:
'source.xtend': [
'rules',
'sitemap'
]

Thanks!


#4

It has to be:

'*':
  core:
    customFileTypes:
      'source.xtend': [
        'rules'
        'sitemap'
      ]

In CSON, arrays elements aren’t separated by commas. And the indentation is significant, so each level should be indented consistently. Atom saves it with two spaces per level, so you should do the same.


#5

Ok thanks for that.
Could you please make an update to your example?


#6

@leedohm thanks for your help!
Now it´s working fine :slight_smile: