babel-sublime: Highlighting breaks if no semicolon after type expressions
When using something from Flow syntax, highlighting may break if no semicolons used. For sample, put something like:
export type A = string
type B = number
The second one would not be properly highlighted if the first one losses semicolon at the end. However, the syntax is correct.
My linting rules encourages to evade semicolons where possible, so I can’t use semicolon at the end of the line.
import type
statements works good.
This would be highlighted properly:
import type { A } from './A'
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 17
- Comments: 31 (2 by maintainers)
I got this working using @Xazzzi’s rough change in the
flowtype-declaration
section. Notably, I had to the change thesublime-syntax
file, not thetmLanguage
file:~/Library/Application Support/Sublime Text 3/Packages/Babel/JavaScript (Babel).sublime-syntax
My final flowtype-declaration looks like:
starting at L207
Screenshot:
Not sure if it’s related but same for static class properties:
Thanks @Xazzzi @sankarravi, this has to be a PR. I almost switched to atom, but then found this.
@michaelcarter It hasn’t been released yet. So you have to go the
~/Library/Application Support/Sublime Text 3/Packages/Babel
and edit the fileJavaScript (Babel).sublime-syntax
accordingly:For sublime, try https://github.com/borela/naomi
@Xazzzi @sankarravi you two are legends! Saved me the effort of switching to vscode 😅
You are welcome to test if it works for you.
@emwalker use Naomi (above in thread).
I wonder if it could be merged. I dont have any experience in language defs DSL’s either and found this fix by trying different things (and failing a lot). This repo seems pretty much abandoned, as last update was 9 month ago. We can ask @zertosh maybe ?
NICE @sankarravi @Xazzzi 👏
Any word on getting this merged into a release?
@mareksuscak @Xazzzi Ok, I’ve got the file there now but editing it does nothing to improve my syntax highlighting. I’m left with code like this:
Drop in a
;
at the end of the type declaration and I get this (much better!):Thanks for all your help so far.
JS Custom provides JSX highlighting and more. It’s based directly on the core JavaScript syntax, so it will never be left behind as the core syntax continues to improve.
Curious what the status of this is. In an earlier PR by @Xazzzi, the fix was placed in the
tmLanguage
file, and that seems to have caused problems. In @sankarravi’s comment above, by contrast, the fix was placed in thesublime-syntax
file, and this worked for me and at least one other person without causing any obvious issues.This bug makes it hard to want to use flow if your repo doesn’t use semicolons, and the fix seems to be an easy one. @zertosh, are there further considerations we should be aware of, or would you be open to a PR?