For syntax highlighting, allow .js-files to start with a shebang

Review Request #117571 - Created April 14, 2014 and submitted

Information
Magnus Hoff
kate
325805
Reviewers
kate
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
I've been using this patch locally, and it works.
Magnus Hoff
Magnus Hoff
Joseph Wenninger
Magnus Hoff
Joseph Wenninger
Commit Hook
This review has been submitted with commit 839ba534f61cb5713fcd2074982649ba8f950c1b by Milian Wolff on behalf of Magnus Hoff to branch master.
Magnus Hoff
Review request changed

Status: Closed (submitted)

Loading...