atom / highlights

Syntax highlighter
https://atom.github.io/highlights
MIT License
530 stars 54 forks source link

Restore ability to detect grammar by file extension #65

Closed jasonrudolph closed 5 years ago

jasonrudolph commented 5 years ago

Fixes #64

Prior to this change, when I run the tests locally, this one fails:

https://github.com/atom/highlights/blob/80ee1a27c4e8568ea2adfe18049fc9610a22d585/spec/highlights-spec.coffee#L32-L35

In the failure output, we can see that it emits syntax--null-grammar instead of syntax--coffee:

Highlights
  highlightSync
    it uses the best grammar match when no scope name is specified
      Expected '<pre class="editor editor-colors"><div class="line"><span class="syntax--text syntax--plain syntax--null-grammar"><span>test</span></span></div></pre>' to be '<pre class="editor editor-colors"><div class="line"><span class="syntax--source syntax--coffee"><span>test</span></span></div></pre>'.
        at jasmine.Spec.<anonymous> (/Users/j/github/highlights/spec/highlights-spec.coffee:35:20)
        at ontimeout (timers.js:498:11)
        at tryOnTimeout (timers.js:323:5)

That failure demonstrates the bug described in #64.

After upgrading first-mate-select-grammar to a version that includes https://github.com/soldair/first-mate-select-grammar/pull/2, the tests pass. đŸ˜…


:pear:'d with @as-cii

jasonrudolph commented 5 years ago

Merged to master in 80ee1a27c4e8568ea2adfe18049fc9610a22d585.