sublime-crystal icon indicating copy to clipboard operation
sublime-crystal copied to clipboard

Support for ECR

Open shobhitic opened this issue 6 years ago • 2 comments

Currently, the .ecr files are being shown as Plain Text files. I couldn't find a way to syntax highlight there. I think it should be a part of official crystal sublime package.

shobhitic avatar Jun 24 '18 08:06 shobhitic

I got it to work (kinda), but not sure how to make it into a package. Just save this

%YAML 1.2
---
file_extensions:
  - ecr
scope: text.html.ruby

contexts:
  main:
    - match: ''
      push: 'scope:text.html.basic'
      with_prototype:
        - match: "<%+#"
          scope: punctuation.definition.comment.ecr
          push:
            - meta_scope: comment.block.ecr
            - match: "%>"
              pop: true
        - match: "<%+(?!>)[-=]?"
          scope: punctuation.section.embedded.crystal
          push:
            - meta_scope: source.crystal.embedded.html
            - match: "-?%>"
              scope: punctuation.section.embedded.crystal
              pop: true
            - match: (#).*?(?=-?%>)
              scope: comment.line.number-sign.crystal
              captures:
                1: punctuation.definition.comment.crystal
            - include: "Crystal.sublime-syntax"

as ECR.sublime-syntax on your User packages folder.

sardaukar avatar Apr 08 '20 19:04 sardaukar

This also works for me; it's not perfect but way better than nothing. :)

plambert avatar May 23 '24 00:05 plambert