Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

25000 context sanity limit hit #191

Closed
skys215 opened this issue May 24, 2021 · 2 comments
Closed

25000 context sanity limit hit #191

skys215 opened this issue May 24, 2021 · 2 comments

Comments

@skys215
Copy link

skys215 commented May 24, 2021

I have faced this problem when using on Sublime Merge and SublimeText 4.

When I was using SublimeText3, it didn't appear, but it appears when I open Sublime Merge.

After I upgraded SublimeText to v4, this error appears when I open the Sublime with a project loaded.

error: Error loading syntax file "Packages/Laravel Blade Highlighter/blade.sublime-syntax": Apparent recursion within a with_prototype action: 25000 context sanity limit hit
@skys215
Copy link
Author

skys215 commented May 24, 2021

Problem solved after disabling JavaScriptNext - ES6 Syntax package package.

May I ask why it is occuring?

@deathaxe
Copy link
Contributor

Sublime Text's syntax engine limits amount of contexts a syntax definition may consist of to 25000 to protect ST from consuming too much RAM.

Normal syntaxes consist of a few hundreds or maybe thousands of contexts.

Blade uses with_prototype to inject patterns for templates into ST's HTML syntax, which requires each context of HTML and all its included syntaxes (CSS, JS, JSON) to be duplicated. As syntax definitions evolve and become more and more complex it is more likely to hit the sanity limit by using with_prototype. with_prototype may also fail to detect whether it already duplicated a context or not and thus creates a so called inclusion loop. It means it copies a context as often as it is included somewhere. Recent ST builds (4126+) take several counter measures to prevent that from happening.

In general it is however a better approach to avoid with_prototype when handling more complex syntaxes. Therefore ST4 introduces the embed directive.

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

No branches or pull requests

3 participants