Sublime Forum

Javascript syntax highlighting bug

#1

Hi,

The following js code doesn’t syntax-highlight correctly:

function validName (name) {
  if (!name) {
    debug("not a name %j", name)
    return false
  }
  var n = name.trim()
  if (!n || n.charAt(0) === "."
      || !n.match(/^[a-zA-Z0-9]/)
      || n.match(//()&?#|<>@:%\s\\*'"!~`]/)
      || n.toLowerCase() === "node_modules"
      || n !== encodeURIComponent(n)
      || n.toLowerCase() === "favicon.ico") {
    debug("not a valid name %j", name)
    return false
  }
  return n
}

It’s a valid function, but Sublime 3 thinks that it’s commented from somewhere in line 9 onwards.

Are the syntax highlighting files available to view or indeed open-source? :smile:

Thanks,
Tom

0 Likes

#2

Fixed on dev build (can not reproduce on 3095).

0 Likes