corneliusio / svelte-sublime

đź’ˇSublime Text syntax highlighting for Svelte components
MIT License
58 stars 6 forks source link

Sublime Text 4121 #17

Closed cyberquito closed 2 years ago

cyberquito commented 2 years ago

Hello,

I just upgrade sublime text to version 4121. The highlighting on html is not working properly anymore. The error starts on the first closing bracket. From there on, every tag is off. The script section works fine.

I'm on a Linux Ubuntu 21.04.

Screenshot from 2021-10-26 14-19-43

ghost commented 2 years ago

I'm on Windows, this started happening after the update as well. Looks like HTML that contains JS is not highlighting correctly: svelteJs

jrappen commented 2 years ago

To fix this fix the embeds for:

as https://github.com/sublimehq/Packages has changed recently.

corneliusio commented 2 years ago

@cyberquito @teaguehannam @jrappen Thanks for reporting, I also just updated to Sublime Text 4 and discovered this issue. I've been busy with my full-time job the last couple of months and have fallen behind on my personal work. Will get this fixed ASAP.

jrappen commented 2 years ago

In case you need help there is a SublimeHQ Discord

ilokhov commented 2 years ago

Thanks so much for looking into this @corneliusio! I believe this references the same issue.

ccampbell commented 2 years ago

@corneliusio I just opened a PR (#18) with a fix. Feel free to use it or modify it if you have a better fix in mind!

burlesona commented 2 years ago

Sorry to pile on, just wanted to confirm I see the same issue with the same cause, after the first closing } the highlighting breaks. Caused by the recent Sublime Text update. What a bummer, @corneliusio sorry the Sublime Team broke your package :(

corneliusio commented 2 years ago

@burlesona Ha, is what is, nature of a package/plugin based ecosystem.

Noting here, I've started working on some fixes that are in the https://github.com/corneliusio/svelte-sublime/tree/v4 branch. There are still some issues, but it's far less broken than the current release. Feel free to manually install while I finish up some of the smaller fixes.

deathaxe commented 2 years ago

The root cause for this issue is JavaScript supporting shebang now, which causes the main context to be pushed away from.

see: https://github.com/sublimehq/Packages/blob/b19745cf3edd8b19f3b09e207e8a854b3aa424b3/JavaScript/JavaScript.sublime-syntax#L118-L121

Hence you need to change the following line

https://github.com/corneliusio/svelte-sublime/blob/c71f1290b061c79c027b5eb002ed06aa6d874ffe/Svelte.sublime-syntax.yaml-macros#L139

to:

  embed-scope:
    - meta_scope: meta.embedded.block.svelte
    - meta_content_scope: source.js.svelte
    - match: \}
      scope: punctuation.section.embedded.end.svelte
      pop: true
    - include: Packages/JavaScript/JavaScript.sublime-syntax#script   # <- directly include scripts.
ccampbell commented 2 years ago

Thanks @deathaxe, that is certainly much simpler than my fix. Didn’t know about that change.

corneliusio commented 2 years ago

Heyo, thanks @deathaxe for zeroing in on that! That adjustment seems to have fixed everything I can find. I'll be tagging a release for this fix but if anyone wants to snag the updated syntax definitions waiting for the release to propagate, it's in https://github.com/corneliusio/svelte-sublime/tree/v4.

corneliusio commented 2 years ago

Closing this out now as the fix should be available to everyone soon via Package Control update.