This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/117571/

Review request for Kate.
By Magnus Hoff.

Updated April 16, 2014, 6:12 a.m.

Changes

Updated all references to ##JavaScript to go to Normal##JavaScript instead. I have tested this interactively with html (only), and with this change, html highlighting works as before: No highlighting of shebang, and proper highlighting of the rest. Presumably, this is the same for other places that include the JS-syntax rules.
Bugs: 325805
Repository: kate

Description

When writing node.js scripts it is common to include a shebang at the top, like `#!/usr/bin/env node`, and save it in a .js-file. However, the syntax highlighter for JavaScript does not understand the shebang, and tries to highlight it as JavaScript.

It is understood as two literal regular expressions (/usr/bin and /env node), the last of which is not closed, meaning that the rest of the file is attempted understood as part of the last regular expression.

This defeats syntax highlighting for .js-files that start with a shebang.

This patch allows .js files to start with a shebang.

This fixes https://bugs.kde.org/show_bug.cgi?id=325805

Testing

I've been using this patch locally, and it works.

Diffs (updated)

  • part/syntax/data/javascript.xml (260aa72)
  • part/syntax/data/html.xml (756fa8f)
  • part/syntax/data/djangotemplate.xml (5189f86)
  • part/syntax/data/coffee.xml (043e51b)
  • part/syntax/data/rhtml.xml (d4a21ba)
  • part/syntax/data/qml.xml (6fa6a40)
  • part/syntax/data/php.xml (b7d30b7)
  • part/syntax/data/mediawiki.xml (6c56ac9)
  • part/syntax/data/mako.xml (cfac839)

View Diff