&gt; I&#x27;ve never used a language mode that worked properly in all cases.<p>You need a full parser for that to happen, most mode authors don&#x27;t bother[0]. JS2-mode (<a href="https:&#x2F;&#x2F;github.com&#x2F;mooz&#x2F;js2-mode&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mooz&#x2F;js2-mode&#x2F;</a>) does that (or attempts to).<p>Most syntactic colorisers are souped-up tokenisers, not actual parsers. It suffices in 99% of cases, but breaks badly elsewhere.<p>[0] it would help if more languages made fast parsing machinery externally available as a convenient API. ALAS, that&#x27;s rarely the case, even less so for fast parsing machinery which doesn&#x27;t throw the information you need for syntactic coloration out the window.