Sublime Forum

Problem with HTML snippets when % is used

#1

Hi

It looks like snippets on multiple lines are not working when file begins or contains “<%” pattern.
This pattern is widely user in some template languages like Mako (e.g. <%inherit file="/index.html" />).
Scenario:

  1. New file with HTML type. Put:

<% Test1 Test2 Test3 Test4
2. Select text:

Test1 Test2 Test3 Test4
and press Ctrl+Shift+L
3. Press ‘p’ and then press Tab key.
Instead of:

[code]<%

Test1

Test2

Test3

Test4

[/code] Sublime inserts the following code: [code]<% p p p p[/code] If I've remove '%' sign it works fine. It looks like a problem with HTML lexer (wrong scope is used)?

Regards,
Artur

0 Likes

#2

[quote=“sublimator”]The snippets are disable inside <% %> as the scope is likely set to something akin “text.html -source”
By default, when using HTML, anything inside <% %> is considered embedded ruby (text.html.basic source.ruby.embedded.html)[/quote]

But you can enter something like this and this is valid syntax:

<%inherit file="/base.html" />

IMHO ruby scope range should changed to: anything inside <% %> or anything inside <% />
BTW I’ve use “HTML” bundle instead of “HTML (Rails)”.

Yes, but problem occured when I’ve tried to use this bundle, error message box is displayed:

Error loading syntax file Packages/HTML Mako/HTML (Mako).tmLanguage: Unknown include #embedded-code

Regards,
Artur

0 Likes