Coder Social home page Coder Social logo

Comments (5)

blake-regalia avatar blake-regalia commented on June 1, 2024 2

After spending a bit of time working on this, it's clear that the existing pug syntax requires somewhat substantial modifications to be compatible within ours. It also leaves something to be desired since it is does not always follow conventional scope naming. The repo has gone stale some time ago and I personally use pug wherever I can so I may just end up forking or rewriting the pug syntax from scratch 🤨

from ecmascript-sublime.

bathos avatar bathos commented on June 1, 2024 1

Nice.

I wonder if we should allow just recognizing certain “well-known” tags like “pug” without the hint comment? It seems sufficiently unlikely to me that the name “pug” would appear for other tags.

In any case, having added it @freemember007, please feel free to open a PR with your changes if you believe this is working right and will be useful to others.

from ecmascript-sublime.

blake-regalia avatar blake-regalia commented on June 1, 2024 1

Thanks @freemember007 . I will take care of PR -- I have a local branch which adds pug following the same build process as HTML and Markdown because these syntaxes push or embed source.js, so we have special handling to prevent infinite recursion / exceeding stack limit in ST3.

However, it seems that pug-tmbundle might be slightly incompatibility with our syntax as is since it is not so straightforward to simply push into our syntax without context and assume it will recover, e.g.
screen shot 2019-03-08 at 9 58 54 am

from ecmascript-sublime.

bathos avatar bathos commented on June 1, 2024

Sounds good. I would guess this can be added following the pattern @blake-regalia has established for other tagged template cases if a sublime syntax def for pug already exists. Otherwise we’d have to add new rules just for pug (which is okay, but it’d be nice to just be able to reuse what’s out there).

@freemember007 is there an existing pug sublime syntax package?

from ecmascript-sublime.

freemember007 avatar freemember007 commented on June 1, 2024

@bathos yes, exists pug sublime syntax package, and I have achieved it by modifying the ecmascript.sublime-syntax source file:

%YAML 1.2
---
name: Ecmascript
file_extensions: [ js, jsx, es, es6, mjs ]
scope: source.es
...
...
variables:
...
...
  syntaxDirective_PUG:   '[Pp](?:UG|ug){{syntaxDirectiveTail}}'
...
...
  syntaxDirective: >-
...
...
        | {{syntaxDirective_PUG}}
...
...
contexts:

# MAIN, META & PROTOTYPE #######################################################

  main:
...
...

  syntax_DIRECTIVE:
...
...
    - match: '{{syntaxDirective_PUG}}'
      captures:
        1: punctuation.definition.comment.end.es
        2: entity.quasi.tag.name.js # ^BS
        3: variable.other.readwrite.tag.es
      set: [ syntax_meta_PUG, syntax_PUG_OPEN ]
...
...

# PUG SYNTAX ###################################################################

  syntax_meta_PUG:
    - meta_content_scope: meta.interpolation.syntax.pug
    - meta_include_prototype: false
    - match: '{{PLA_anything}}'
      pop: true

  syntax_PUG_OPEN:
    - meta_include_prototype: false
    - match: '`'
      scope: string.interpolated.es punctuation.definition.string.interpolated.begin.es
      set: scope:text.pug
      with_prototype:
        - include: syntax_AFTER_OPEN
...
...

this is the appearance:

img

thank you for write so awesome plugin!

from ecmascript-sublime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.