Thom1729 / Sublime-JS-Custom

Customizable JavaScript syntax highlighting for Sublime Text.
MIT License
137 stars 9 forks source link

Bug using slash in string #56

Closed LoiKos closed 5 years ago

LoiKos commented 5 years ago

i have a bug using a / in a string that break the syntax coloration :

 let type = null
    if (bill) {
      type = 'Ex/ample' // here syntax isn't render correctly 
    } else if (vn) {
      type = 'Something'
    } else if (ctn) {
      type = 'Something else'
    } else if (imo) {
      type = 'Something else'
    }

capture du 2018-12-24 11-24-29

mohitsinghs commented 5 years ago

Okay, I was able to reproduce this. ~It appears like this is not a bug, and instead a feature.~ It's both I'm not using flow but as I looked into docs, the culprit is your type variable, which is being treated as flow type annotation. Now there are two things —

I hope this helps.

LoiKos commented 5 years ago

Oh okay i find that flow_types option i'll take a look... I don't yet if i remove this or if i change my variable name but it helps thanks !

Thom1729 commented 5 years ago

When the flow syntax extension sees type at the beginning of the line, it assumes that it's a type annotation. This should be an easy fix. If I don't get to it today due to the holidays, it should be fixed by Wednesday.

Thom1729 commented 5 years ago

By the way, in the immediate term you can work around this by wrapping the statement in parens:

(type = 'Ex/ample');
Thom1729 commented 5 years ago

v1.0.28 should fix this. Please let me know if it does not.

LoiKos commented 5 years ago

it's fix with v1.0.28 :+1: