From kwrite-devel Wed Apr 16 06:12:33 2014 From: "Magnus Hoff" Date: Wed, 16 Apr 2014 06:12:33 +0000 To: kwrite-devel Subject: Re: Review Request 117571: For syntax highlighting, allow .js-files to start with a shebang Message-Id: <20140416061233.14848.85396 () probe ! kde ! org> X-MARC-Message: https://marc.info/?l=kwrite-devel&m=139762876610533 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============7135855600633758147==" --===============7135855600633758147== Content-Type: multipart/alternative; boundary="===============2498294492297064423==" --===============2498294492297064423== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://git.reviewboard.kde.org/r/117571/ ----------------------------------------------------------- (Updated April 16, 2014, 6:12 a.m.) Review request for Kate. 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 http://bugs.kde.org/show_bug.cgi?id=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 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 Diff: https://git.reviewboard.kde.org/r/117571/diff/ Testing ------- I've been using this patch locally, and it works. Thanks, Magnus Hoff --===============2498294492297064423== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit
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

--===============2498294492297064423==-- --===============7135855600633758147== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KWrite-Devel mailing list KWrite-Devel@kde.org https://mail.kde.org/mailman/listinfo/kwrite-devel --===============7135855600633758147==--