Assigning Language Recognition - unsure how to set correctly


#1

I have various file types (.html, .txt, …) which additionally have “.liquid” extension added. These files also include YAML markup in the first few lines, so Atom sees these as YAML.
I’ve tried changing the config.cson file, for example to recognise files with .html.liquid extensions as HTML but what I’ve done isn’t working:
clt
Any tips as to what I’m doing wrong?


#2

What happens if you cut out the html. and just put liquid?


#3

Doesn’t seem to change anything. If I create a file say: ‘test.html.liquid’, Atom just recognises it as ‘Plain Text’.
I would think, however, that doing this would assign ALL .liquid files as HTML which is not what I’d want as there could be other file types in this same situation, eg: test.txt.liquid

Is ‘text.html.basic’ the right source to use here?


#4

It works for me, both ways.


#5

Thanks so much for persisting with this for me. Much appreciated.
I wonder, what you see if you didn’t have the customFileType config in there at all? ie: just letting Atom detect a newly created file with .html.liquid extension. Is it possible some other plugin of yours is making this detection possible???
(I pretty much have a clean install of Atom with only a few linter packages installed)


#6

Just what I expect: it doesn’t work.

Is it possible some other plugin of yours is making this detection possible???

It is not. The customFileTypes config setting is a core Atom feature described in the Flight Manual and defined here. Many features in Atom live in packages, like find-and-replace and tabs, but this feature is part of the core.

Do you have anything in your init.coffee file? If you start Atom from the command line with the command atom --safe, does the customFileTypes setting work then?


#7

Hmmm… I can’t get Atom to open in safe mode.
The only way I can get Atom to open via the command line is with open -a atom but trying open -a atom --safe gives me an error “unrecognized option ‘–safe’”

There is nothing in my init scripts.

I’m on a Mac (10.13.4)
Atom version 1.26.1

I’m very new to all this and the command line.


#8

So, I considered that maybe language-yaml is overriding the custom config because of firstLineMatch, but I can’t replicate that (see below).

Could it be that the Mac build behaves differently from Windows in the order it applies matching rules? That seems unlikely. Are you sure you don’t have any packages that aren’t linter providers?


#9

Does atom --safe not work? If it doesn’t, you have bigger problems than custom file types. Did you install shell commands? Do this by opening Atom and then in the top bar Atom -> Install Shell Commands


#11

Ah. Thanks for the Shell Commands tip… didn’t know I needed to do that.
I can now open in safe mode.


#12

Ok so I figured out the issue - not because of safe mode but just ad-hoc testing…
I moved my customFileTypes config code to come first at it now works:
config2
Previously it was:
config-old
Not sure why, but it works.

Thanks so much for your help along the way.


#13

The before and after are very different. Indentation is important in CSON.

Before, you had customFileTypes under the "exception-reporting" key. Now you placed it under core, it works as it should.