After update
Error loading syntax file “Packages/PHP/PHP.sublime-syntax”:
Apparent recursion within a with_prototype action: 25000 context sanity limit hit
Syntax Highlight Error after update Build 4186
I’m seeing the same issue with the Django Syntax plugin (in HTML files, specifically).
Does it happen in safe mode? Can you provide an example file that reproduces the issue?
Plain PHP
PHP uses push...with_prototype
only to support regexp patterns in strings, which is known to be safe.
I’d suggest checking for possible out-dated PHP package overrides. A loong time ago, PHP used to use that strategy to combine HTML and PHP source, which already caused that kind of issues back in the days.
I even just about to work on/with PHP Blade templates, which extend PHP and still work fine on ST4186/87
Django Syntax
With Django Syntax this is still true today. This kind of implementation no longer works due to complexity all involved syntaxes reached.
I’d suggest to use Jinja2 instead, which uses an up-to-date implementation.
I can reproduce this in safe mode:
The syntax file involved: https://github.com/willstott101/django-sublime-syntax/blob/master/Django%20HTML.sublime-syntax
It’s since build 4186, and still present in build 4189.
Steps to reproduce:
- Start Sublime Text in safe mode
subl --safe
- Install Package Control
- install Django Syntax with
Package Control
- Just any (html) file with
Django Syntax -> Django HTML
will give thecontext sanity limit
error.
Example html, just in case:
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
From the message from @deathaxe I understand the way the syntax file is build up is not “up-to-date” to current standards.
Any pointers on this would be helpful: Should the syntax file be made up-to-date (and if so, how), or should this still work and can this be considered a bug?
This issue is triggered by adding html syntax highlighting of tagged template tags in JavaScript , which causes an inclusion loop for all syntax definitions still using push .. with_prototype
to extend HTML.sublime-syntax.
For details refer to: https://github.com/sublimehq/sublime_text/issues/6555
That being said, Django Syntax is just one of them. I’d recommend to replace it by Jinja2 package, which provides even more accurate highlighting.
If something Django specific is missing, feel free to open an issue and we can look into adding it. Django templates are just Jinja2 templates with some extensions. Hence there’s actually no reason for all the different packages.