Skip to content

Conversation

@deathaxe
Copy link
Member

@deathaxe deathaxe commented Feb 6, 2025

Fixes #5
Fixes #6
Fixes #7

This PR replaces push...with_prototype by extending ST's HTML syntax

Main scope is changed from text.ejs to text.html.ejs in order to also support all HTML related completions, snippets and behavior within EJS templates.

Note

It supports <%...%> within HTML, but not in <script> or <style> tags. Not familiar with EJS to judge whether that's needed/supported.

@deathaxe
Copy link
Member Author

Any objections about moving the package to SublimeText org?

@nwoltman
Copy link
Collaborator

This is great. Thanks @deathaxe!

It supports <%...%> within HTML, but not in <script> or <style> tags. Not familiar with EJS to judge whether that's needed/supported.

It's possible to enter embedded JS with the <%...%> tags anywhere in the HTML scope, so that is definitely needed. Would that be done similar to how you did it for tags and strings?

Any objections about moving the package to SublimeText org?

Not at all! If we're going to do that, we may want to coordinate with the maintainer of the https://packagecontrol.io/packages/EJS package so we can use the "EJS" package name (instead of "EJS 2"). I originally made this package because that one had gotten outdated and it seemed like it was unmaintained. We did talk about transferring the "EJS" name to my package but that never ended up happening.

@deathaxe
Copy link
Member Author

<%...%> tags anywhere in the HTML scope

Already put a little more work on it at https://github.com/deathaxe/sublime-ejs/tree/st4152 (lazily squshing all changes) to follow the strategy we already use for PHP, which (as EJS) is a template engine which doesn't care about underlying (HTML) syntaxes.

Mixing two context intensive syntaxes (e.g. JS and CSS) is hard, so we have to make compromizes, but it should work for most real world use cases.

For now, I kept only the most common tag names <% %> and <? ?>, but we could add more (again) if needed. It's a bit tricky anyway as EJS support all sorts of custom template tags.

moving the package to SublimeText org

  1. primary driver is being able to quickly deploy needed fixes/tweaks in case core syntaxes change in relevant ways. That's required because st4152 branch introduces changes which couple EJS more closely with ST's core syntaxes.

  2. another driver is keeping track of those syntaxes, which rely on ST's default ones, more easily.

  3. Using "EJS" package name is a planned task for a next release

    We've already moved or forked various unmaintained packages to SublimeText organization to be able to ship fixes or improvements and used that step to deduplicate package index.

    And so we would do in this case. Moving a package is preferred over forking.

    We can configure package_control_channel to ship old EJS package with its tmLanguage files for ST2 or create an ST2 branch for it in this repo (to ensure availability until the end of time).

Note, that I happily add you as a maintainer so you still will have full access to your repo.

Github forwards any request from your current repo to any new location, so moving and updating index doesn't need to take place a the same point of time.

This commit ...

1. replaces `push...with_prototype` by extending HTML, CSS and JavaScript.

2. adds support for $TEMPLATE_START and $TEMPLATE_END snippet variables,
   to avoid duplicated snippet variables or key bindings.

3. adds support to toggle `<%# %>` comments

4. removes `<$ $>` and `<@ @>` variants, keeping only most commonly used ones.

   Actually EJS supports anything (even `[% %]` or `{% %}` all of which is
   impossible to support at the same time via static syntax definitions.

   It would make more sense to dynamically create them via templates.

5. drops Dracula Color scheme as color schemes should not be bundled
   with syntax definitions and syntax only uses scopes according to ST's
   scope naming guide. It should be easily possible for original Dracula
   color scheme to support them.
@nwoltman
Copy link
Collaborator

@deathaxe I looked at your branch. I'm happy to move this package to the Sublime Text org. Please let me know if there's anything I need to do to help facilitate this.

@deathaxe
Copy link
Member Author

You'd have to initiate the transfer at the bottom of repository settings, via "Transfer Ownership" button. It should either directly move the repo or send a confirmation email to SublimeText admins to accept the move.

@nwoltman
Copy link
Collaborator

I tried transferring ownership to the sublimehq org, but I got an error saying

You don’t have the permission to create public repositories on sublimehq

Not sure if you got any notification for this. Some permissions might need to be changed on your end to allow me to transfer to the repo to your org.

@deathaxe
Copy link
Member Author

Community packages are organized under https://github.com/SublimeText. This is where EJS should find its new home.

The "error" message you see when initiating ownership transfer, just indicates an admin of the target organization to need confirm the transfer. As soon as it is confirmed, transfer is started.

@nwoltman
Copy link
Collaborator

Ah thank you. I've now initiated a transfer to the SublimeText org.

@deathaxe
Copy link
Member Author

Sent you an invitation to SublimeText org to enable transfer and later on being able to assign you moderator rights to your repo again. Seems I was on wrong track with just approving being enough.

@nwoltman
Copy link
Collaborator

OK everything seems to be good now. It's been moved.

@deathaxe deathaxe merged commit d58e79e into SublimeText:master Feb 27, 2025
5 checks passed
@deathaxe deathaxe deleted the extend-html branch February 27, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loading issue as of Sublime version 4186 Showing error when no error Loading Syntax File Error … or No Error?

2 participants