area / language-latex

Syntax highlighting for LaTeX for Atom.
Other
79 stars 47 forks source link

Splitting grammars into 'repositories' #97

Open yudai-nkt opened 8 years ago

yudai-nkt commented 8 years ago

As per #95, contributors (and even I) get confused where to add new grammars. The current grammar files contain more than 2K lines without any policy about ordering, which lowers readability as well as makes contributors confused. I here suggest using repository feature. By utilizing this, PR #95 would be turned into something like

repository:
  gnuplottex: # package name of something similar here
    patterns: [
      {
        begin: '(?:\\s*)(\\\\begin)(\\{)(gnuplot)(\\})(\\[)(.*)(\\])?'
        captures:
          1:
            name: 'support.function.be.latex'
          2:
            name: 'punctuation.definition.arguments.begin.latex'
          3:
            name: 'variable.parameter.function.latex'
          4:
            name: 'punctuation.definition.arguments.end.latex'
          5:
            name: 'punctuation.definition.arguments.optional.begin.latex'
          6:
            name: 'variable.parameter.function.latex'
          7:
            name: 'punctuation.definition.arguments.optional.end.latex'
        end: '(?:\\s*)(\\\\end)(\\{)(\\3)(\\})'
        name: 'meta.embedded.block.source'
        contentName: 'source.embedded.gnuplot'
        patterns: [
          {
            include: 'source.gnuplot'
          }
        ]
      }
    ]

and we can include #gnuplottex repository. If we decide how to order each repository (e.g., Alphabetical order) then, it will enhance readability and maintainability.

Here are some good examples of this approach:

Aerijo commented 7 years ago

Seconded. All repository is the way to go. Much easier to reuse code and reorder parts.

yudai-nkt commented 7 years ago

Thank you for your opinion and apologies for not maintaining the package for quite a long, @Aerijo.

I've been busy with the deadline for a conference paper, so I'm afraid to say that I don't have much time to go this way immediately. After the submission (around the middle of August), I will be able to spare some time for this (including other issues).

Thanks again for your involvement. I haven't read all the comments you gave here in the last few days, but will definitely have a check at them.