To add custom scopes in SublimeText

To add custom scopes in SublimeText


The files below are found in C:\Program Files\Sublime Text\Packages :


=== HTML (Plain).sublime-syntax in HTML.sublime-package ===

 comment:

  #beginning of insertion

   - match: '(?i:<!--\s*-{4}[a-z0-9éèà_-]+(?:\s+[a-z0-9éèà_-]+)*\s*-->)'

     scope: comment.block.OuvSection.html

   - match: '(?i:<!--\s*[a-z0-9éèà_-]+(?:\s+[a-z0-9éèà_-]+)*-{4}\s*-->)'

     scope: comment.block.FermSection.html

  #end of insertion

  - match: (<!--)(-?>)?

    captures:

      1: punctuation.definition.comment.begin.html

      2: invalid.illegal.bad-comments-or-CDATA.html

    push: comment-content


=== JavaScript.sublime-syntax in JavaScript.sublime-package ===

 block-comments:

   #beginning of insertion

   - match: '(?i:/\*\s*-{4}\s*[a-z0-9éèà_-]+\s*.*?\*/)'

     scope: comment.block.OuvSection.js

   - match: '(?i:/\*\s*[a-z0-9éèà_-]+\s*-{4}\s*.*?\*/)'

     scope: comment.block.FermSection.js

   #end of insertion

   # empty block comments

   - match: /\*\*+/

     scope: comment.block.empty.js punctuation.definition.comment.js


And also, for // :

 line-comments:

   #beginning of insertion

   - match: '(?i)//\s*-{4}\s*([a-z0-9éçèà_]+(?:\s+[a-z0-9éèçà_]+)*)'

     scope: comment.line.OuvSection.js

   - match: '(?i)//\s*[a-z0-9éèà_]+(?:\s+[a-z0-9éèà_]+)*\s*-{4}(?!-)(?=\s*//|\s*/\*|\s*$)'

     scope: comment.line.FermSection.js

   #end of insertion

   - match: /{4,}

     scope: punctuation.definition.comment.js

     push: line-comment-other-body


=== CSS.sublime-syntax in CSS.sublime-package ===

 comments:

  #beginning of insertion

   - match: '\/\*\s*-{4}[^\s][^*]*?\*\/'

     scope: comment.block.OuvSection.css

   - match: '\/\*\s*[^-\s][^*\/]*?-{4}\s*\*\/'

     scope: comment.block.FermSection.css

  #end of insertion


   # empty block comment

   - match: (/\*+)(\*/)

     scope: comment.block.css

     captures:

        1: punctuation.definition.comment.begin.css

        2: punctuation.definition.comment.end.css


=============================


And then, if you kept the same scopes as i did, just add that in your color-scheme(, the colors are bad i know, i haven't made up my mind yet) :

 {"scope": "comment.line.OuvSection, comment.block.OuvSection", "background": "#fcff3e", "foreground": "black", "font_style": "bold"},

 {"scope": "comment.line.FermSection, comment.block.FermSection", "background": "#d7d944", "foreground": "black", "font_style": "bold"},

Report Page