-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken highlighting in Build 3154 #107
Comments
The way that I would fix this is by using the new |
I'd love to rewrite this using the |
There's a temporary workaround to fix this with the current |
@skyronic doesn't quite work for me: Just loses all highlighting in the |
@n-kort can you have your cursor somewhere in the script block and press control+shift+p (OSX) or ctrl+alt+shift+p (Windows and Linux). It should pop up some text. can you paste that here? |
with the cursor just after |
Ok. I'll send a early version of the syntax definition sometime within 12 hours, hopefully you can try that and tell me if it works for you :) |
@n-kort @yyx990803 I can confirm that in the latest dev build of sublime, it seems to be working when I disable JavaScript and install Babel. In fact, I'm thinking the issue is actually with sublime's JS implementation. Please see https://gfycat.com/anotherseriousfritillarybutterfly for a quick screencast. |
Filed an issue with Sublime for their JS syntax implementation which looks wrong sublimehq/Packages#1309 @Thom1729 if possible, can you verify if my issue is valid and is something that needs to be fixed from Sublime's end? |
@skyronic yep that's what I'm getting too |
Sublime's JavaScript package has changed. The core JavaScript package's old behavior and the Babel package's behavior are incorrect. The core JavaScript package's new behavior is correct. Here's another example: var x, g;
export default {
foo: 42
}
/x/g; The Babel package will erroneously mark |
(comment removed since it was irrelavant and you'd answered the question elsewhere) |
On the contrary, that is exactly what should happen. Here are near-minimal examples: export default 2 + 2;
export default 2; + 2; The first line exports the value of the expression Now imagine that there is a line break after the first export default 2
+ 2;
export default 2;
+ 2; The meanings of these statements are not changed by the line break. There are only a few cases in JavaScript where adding a line break will change the meaning of a valid statement, and this is not one of them. Suppose that you are a syntax highlighter and you see:
You can't assume that the statement will end at the first line break. You can't assume that the statement has ended until you encounter a semicolon (or a line break followed by a token that triggers automatic semicolon insertion). You're still inside an export statement until something kicks you out of it, no matter how long it may take. The JavaScript syntax can be very unintuitive at times, particularly where missing semicolons are concerned. I would bet good money that the new implementation isn't perfect. But I am very confident that its behavior in this case is correct and that the previous behavior was a bug. Notwithstanding any of the above, even if everything I've said is wrong and the old behavior was correct, the way that the Vue syntax embeds JavaScript relies implicitly upon a false assumption about the core JavaScript syntax: that when the JavaScript code ends, only the |
@alancwoo This is due to bugs in babel-sublime that have been fixed in the core JavaScript package. If those bugs are ever fixed, the Vue syntax will break when using babel-sublime. |
Note: Reverting sublime to the stable channel with the core JavaScript package also fixes the issues (Build 3143) |
Hey @n-kort you should be able to install the latest version from package control and should fix the issue. Lemme know if you encounter any other problems with the new highlighting! Closing this issue now. |
Also posted over at sublimehq/Packages#1302
The text was updated successfully, but these errors were encountered: