highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

Time to finally allow negative lookbehind?

Open joshgoebel opened this issue 2 years ago • 4 comments

I just checked and the latest versions of Safari (that now support negative lookbehind) [16.4, 16.5, etc] go all the way back to Big Sur, supporting:

  • Big Sur (November 12, 2020)
  • Montery (October 25, 2021)
  • Ventura (October 24, 2022)
  • Sonoma (September 26, 2023)

Big Sur support extends all the way back to Mac's from 2013. I have some sympathy for those who hold off a while on OS releases, but little for those who would avoid installing the newest version of Safari (since often there are security fixes, etc)... so I think if we allow support for negative lookbehind we'd only be dropping support for Mac's 10+ years old or those refusing to upgrade their Safari - in which case I'd suggest they use another browser instead, such as Chrome.

So I say it's time to allow look-behind...

Thoughts, @allejo ?

joshgoebel avatar Oct 15 '23 18:10 joshgoebel

As long as the introduction of negative lookbehinds in grammars is introduced in 12.0 and not in our 11.x series, you have my support :+1:

Solely on principle for semantic versioning, I'd be hesitant to introduce a breaking change in browser support in a minor release

allejo avatar Oct 19 '23 06:10 allejo

I have quite a few personal lexers that really require the use of lookbehinds as my current workarounds do not work for all cases. Is there a timeline on when lookbehinds will be allowed?

kuenzign avatar Jan 10 '24 22:01 kuenzign

Well if they are truly personal, just use them... it's only the core library that we aren't allowing them in v11 because of semantic versioning. I haven't had much time lately to do a major release but it's a long weekend so I'll take a look at where we stand with v12...

@allejo The old website handled us being able to publish two major versions at once - and it just did the right thing (pay attention to the new one)... does the new website share this characteristic - what if say we pushed a few 12.0.0-beta or alpha relases? (the old website would also ignore alpha/betas, etc)

joshgoebel avatar Jan 11 '24 22:01 joshgoebel

Ah it looks like all I needed to do was change the ecmaVersion to 2018 in the config to allow it to work. Thanks!

kuenzign avatar Jan 12 '24 14:01 kuenzign