Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Syntax #39

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Commits on Oct 19, 2024

  1. Refactor folder structure

    Refactor folder structure after the scheme of Jinja2 package.
    deathaxe committed Oct 19, 2024
    Configuration menu
    Copy the full SHA
    b839025 View commit details
    Browse the repository at this point in the history
  2. Refactor Syntax

    This commit...
    
    1. introduces common `meta.template.twig` applied scope accross Text/HTML/JS/CSS
    2. adjusts snippet selectors
    3. adds some helper key bindings
    4. applies syntax specific toggle comment rules to apply Twig comments
       by default but retain original syntax's block comment as variant 2.
    5. renames contexts to use hyphens as subword-separators
    6. reorders contexts following lessons learned from Jinja and other template
       syntaxes
    7. apply `meta.embedded` to tags and `source.twig` to their content.
    8. fix various smaller highlighting bugs
    deathaxe committed Oct 19, 2024
    Configuration menu
    Copy the full SHA
    ca98457 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8a52166 View commit details
    Browse the repository at this point in the history
  4. Cleanup key bindings

    A formatting change and removal of some default operator/operand keys.
    deathaxe committed Oct 19, 2024
    Configuration menu
    Copy the full SHA
    92dd9b0 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2024

  1. Fix key binding selector

    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    427b4f7 View commit details
    Browse the repository at this point in the history
  2. Use Twig comments for test assertions

    This commit enables to test embedded CSS, JS, JSON code in Twig templates.
    
    Without it, all test assertions cause illegal syntax highlighting
    in script or style tags.
    
    Note: It drops some tests for leading `{{` and `{%` due to assertion punctuation
    now requiring 2 chars, but those are most often redundant anyway.
    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    e669c94 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    536a2e7 View commit details
    Browse the repository at this point in the history
  4. Align HTML (Twig) with HTML (Jinja)

    - reorder style tag context
    - add some backward compatibility fixes
    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    05006cc View commit details
    Browse the repository at this point in the history
  5. Add JSON support

    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    f44b204 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    91f2e85 View commit details
    Browse the repository at this point in the history
  7. Fix various jinja residents

    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    ca04bb3 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    3599f7f View commit details
    Browse the repository at this point in the history
  9. Add support for guard tag

    Supported by Twig 3.15+
    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    567e3a1 View commit details
    Browse the repository at this point in the history
  10. Split snippets into block- and tag-snippets

    Adds snippets for individual tags so typing a tag name and hitting tab key
    expands to an individual tag enclosed in `{% ... %}`:
    
       if| =>  {% if | %}
       embed| =>  {% embed | %}
    
    Triggers of existing block snippets are prefixed with `b` to avoid ambiguities
    with tag-snippets. Otherwise it would be unclear whether blocks or tags are
    expanded and/or completion panel was displayed requiring arrow key navigation.
    
       bif|
    
       {% if conditon %}
          |
       {% endif %}
    
    Reorganize snippets in individual sub-directories in case someone wants to
    disable individual ones based on type.
    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    5020129 View commit details
    Browse the repository at this point in the history
  11. Fix nested double quotes

    Twig tags within quoted strings can contain same sort of quotes.
    
    This requires another strategy of handling embedded code blocks
    especially in inline event and style attributes.
    
    Solution is borrowed from PHP.
    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    db2d435 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    825f250 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    abc8388 View commit details
    Browse the repository at this point in the history
  14. Optimize embedded JS/CSS syntaxes

    Instead of adding rules to pop on quotes to each context,
    this commit just replaces relevant string contexts of JS/CSS
    to make sure to pop contexts properly.
    
    This reduces compiled syntax cache from 820kB to 610kB.
    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    d9425a5 View commit details
    Browse the repository at this point in the history
  15. Fix twig statement tags in html tags

    This commit fixes Twig statement tags and comments being scoped
    meta.attribute-with-value by accident.
    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    3d0d5bb View commit details
    Browse the repository at this point in the history
  16. Update README

    Add some info about changed snippets.
    
    Snippets are basically aligned with Jinja2.
    deathaxe committed Oct 20, 2024
    Configuration menu
    Copy the full SHA
    1a0b0ee View commit details
    Browse the repository at this point in the history