laravel-blade icon indicating copy to clipboard operation
laravel-blade copied to clipboard

25000 context sanity limit hit

Open skys215 opened this issue 3 years ago • 1 comments

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 avatar May 24 '21 05:05 skys215

Problem solved after disabling JavaScriptNext - ES6 Syntax package package.

May I ask why it is occuring?

skys215 avatar May 24 '21 05:05 skys215

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.

deathaxe avatar Dec 20 '22 15:12 deathaxe