Sublime-Instincts / BetterJinja

A Sublime Text package that provides enhanced syntax highlighting, completions, snippets & more for Jinja templates.
https://packagecontrol.io/packages/Jinja2
MIT License
15 stars 4 forks source link

Add HTML and YAML syntax variants using inheritance #17

Closed a1ro closed 5 months ago

a1ro commented 1 year ago

Hi,

This PR fixes Issue #7 and aims to replace PR #10, this time using the much simpler approach of Syntax inheritance, available since Sublime Text build 4075 (released on July 10, 2020).

Here are a few key points of this pull request:

For a quick explanation, syntax variants can be added by following those steps:

  1. Create a new file for each variant, naming it <Your language> (Jinja).sublime-syntax.
  2. Fill out the values of name, file_extensions and scope keys.
  3. Add an extends key to inherit the variables and contexts from the parent syntax.
  4. Override the main context of the parent syntax, matching both the source language and Jinja.

To make sure the parent syntax can be updated without touching the variants, I added a base context with in turn includes the relevant contexts.

Let me know if you would like to change things before merging.

UltraInstinct05 commented 1 year ago

Sorry for the late response on this one. I do have a working version of refactoring the syntax using Inheritance (that follows the same changes as this branch), but I just haven't gotten around to completing it yet, due to work. It's also on lower priority for me since Inheritance is much better, maintenance & cache size wise, but the highlighting still remains the same.

UltraInstinct05 commented 1 year ago

Here's the issue that's tracking V2.0.0 release https://github.com/Sublime-Instincts/BetterJinja/issues/13. I do plan to get to it sometime late December to early next year, hopefully🤞

intelfx commented 9 months ago

Hi! Is there anything an outsider can do to help get either this PR or v2.0.0 out?

deathaxe commented 5 months ago

Actually a templating syntax should always be extended from its base syntax (e.g.: HTML, JSON, YAML, ...) with contexts from the template (jinja) being added to proper contexts.

Examples are:

deathaxe commented 5 months ago

Closing as superseeded by #22