Comments (5)
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.
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.
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.
from ecmascript-sublime.
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.
@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:
thank you for write so awesome plugin!
from ecmascript-sublime.
Related Issues (20)
- a way of setting the default syntax for a template tag HOT 2
- Add support for graphql nested syntax HOT 5
- Comma background in destructuring assignments HOT 5
- Error loading colour scheme Packages/Ecmascript Syntax/excelsior.tmTheme HOT 4
- Update repository description HOT 3
- Build process does not work on Windows HOT 1
- Pipeline operator
- styled jsx has no css autocomplete and emmet does not work HOT 5
- Use a package setting to override the block comment directive syntax HOT 6
- Add support for interpolated attribute values in HTML / HTML-like template tags without quotation marks HOT 7
- AE identifiers prefixed with reserved words followed by `$`
- Digits after binary/octal HOT 4
- Async iterable inline literal object
- Associating Ecmascript with source.js ? HOT 4
- Update README ? HOT 1
- Symbols are not indexed in embedded syntax HOT 1
- Add DOM support for built-in color schemes HOT 5
- Turn off Safe Mode/Prefer Ecmascript standard mode. HOT 2
- LSP integration HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ecmascript-sublime.