vuejs/vue-syntax-highlight

Rewrite for ST4

Thom1729 opened this issue · 12 comments

The Vue syntax is an extension of the core HTML syntax. Currently, this is implemented by vendoring the core HTML syntax and extending it using macros. Sublime Text 4 offers a new syntax extension feature that should remove the need to vendor the core syntax and may even remove the need for macros. In addition, it would stay up to date as the core syntax is improved.

Is there interest in this? I could probably write up a PR, but I figured I'd ask first before investing the time.

Hey @Thom1729

Thank you for proposing this. This sounds really exciting and I don't see any downside if we do it right. (@yyx990803 feel free to chime in if there are any potential issues with this)

I'd be happy to test and validate that it works well with all the standard cases. I have a few notes though:

  1. We would need to preserve backward compatibility for ST3, I'm not sure how this would work.
  2. Are there any examples of 3rd-party extensions already adopting this new syntax that you're aware of? (just so I understand it better)
  3. Would it be possible to write a few simple syntax tests?

Syntax extensions are ST4-only and do not work in ST3. We would preserve backward compatibility by specifying in the channel entry that the new tags require ST4. Actually, the channel entry is already set up to limit the .sublime-syntax releases to build 3153 and newer.

I don't know of any third-party packages extending syntaxes this way, probably because ST4 is brand new. However, several of the core syntaxes already do this (including the core JSX, TypeScript, and TSX syntaxes) and others are being converted to do so (see sublimehq/Packages#2789).

Syntax tests are definitely possible.

Hey @Thom1729

I apologize for the extended delay in replying. I was spending a bit of time trying to understand the new syntax option, and also refreshing my understanding of the syntax system. I think you can write the upgrades, it would be great to have them merged in!

I'm trying to understand how we would specify the sublime version in the repository JSON. We currently have it listed as:

			"releases": [
				{
					"sublime_text": "<3153",
					"tags": "oldsyntax-"
				},
				{
					"sublime_text": ">=3153",
					"tags": "newsyntax-"
				}
			]

How would the sublime_text conditions look for versions between 3153 and 4000? I couldn't find a specification for the operations supported by that field.

I'm actually not sure about that. The easiest approach would be dropping ST2 support.

I don't think it's feasible to drop ST2 support.

I spent some time digging through the Package Control source code. I found this: https://github.com/wbond/package_control/blob/8b947d227bfee2b514283e650c3f88c954ae1026/package_control/providers/release_selector.py#L62

It appears that there's a "Range" selector where we'll be able to set "sublime_text": "3153 - 4000" but this isn't something I have seen documented anywhere. Let me see if there's any existing package which uses this type of selector, and test it on ST2, ST3, ST4 and confirm this...

rchl commented

I think we can close this now.

Closing now. Thanks! But we are still waiting on package control accepting my PR to update to the new version :)

wbond/package_control_channel#8362

rchl commented

Right. I've had st4 branch checked out manually so didn't notice.

rchl commented

@skyronic just a heads up that the st4-v4.0.0 tag is incorrectly tagging a commit from master branch rather than from the st4 branch.

@rchl Thank you so much for noticing! I've created a new tag!