language-latex icon indicating copy to clipboard operation
language-latex copied to clipboard

Splitting grammars into 'repositories'

Open yudai-nkt opened this issue 9 years ago • 2 comments

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:

yudai-nkt avatar Oct 25 '16 16:10 yudai-nkt

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

Aerijo avatar Jul 17 '17 10:07 Aerijo

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.

yudai-nkt avatar Jul 18 '17 08:07 yudai-nkt