angular-ui / AngularJS-Atom

An AngularJS package for Github's Atom editor
https://atom.io/packages/angularjs
MIT License
284 stars 49 forks source link

Grammar detection is too loose #54

Closed aendra-rininsland closed 8 years ago

aendra-rininsland commented 8 years ago

Howdy! First off, many thanks for the plugin, I find it really helpful when I'm building Angular apps. :+1:

Secondly, alas, this week I'm working on a Polymer project, which is effectively nothing but HTML files. AngularJS-Atom's auto-detection is detecting all of my files as Angular, which is problematic for particularly style modules (wherein the entire file is just one style tag and some HTML imports), insomuch that they lose syntax highlighting altogether.

aendra-rininsland commented 8 years ago

Update: I've read a bit more about Atom grammars, and it seems that grammars are only detected by file extension and firstLineMatch. Doesn't help either that language-html uses the doctype for firstLineMatch, thus ensuring no template file or HTML import will ever benefit from its syntax highlighting... :-1: Any ideas?

Edit: Apparently firstLineMatch doesn't matter that much, or is secondary to fileTypes; grammar detection works fine in Polymer templates when AngularJS-Atom is disabled.

outsideris commented 8 years ago

As you said, it is how auto detection works in Atom. I didn't use firstLineMatch because angular-template files don't include the doctype.

You can change grammar at right-bottom of Atom editor without disabling AngularJS-Atom.

2016-02-05 21 29 46

I don't have any idea to resolve the conflict between plain HTML files and angular's HTML files.

aendra-rininsland commented 8 years ago

Cool, figured as much. Bit of a shame Atom doesn't provide better methods for detecting grammars.

Closing for now, then. :smile:

outsideris commented 8 years ago

Good!!