From kwrite-devel Wed Apr 16 11:20:56 2014 From: "Joseph Wenninger" Date: Wed, 16 Apr 2014 11:20:56 +0000 To: kwrite-devel Subject: Re: Review Request 117571: For syntax highlighting, allow .js-files to start with a shebang Message-Id: <20140416112056.11639.37475 () probe ! kde ! org> X-MARC-Message: https://marc.info/?l=kwrite-devel&m=139764726916463 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============9092318452077250447==" --===============9092318452077250447== Content-Type: multipart/alternative; boundary="===============7426699765524959251==" --===============7426699765524959251== 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/#review55861 ----------------------------------------------------------- Ship it! I think this looks right now - Joseph Wenninger On April 16, 2014, 6:12 a.m., Magnus Hoff wrote: > > ----------------------------------------------------------- > 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. > > > 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 > ----- > > 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 > > --===============7426699765524959251== 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/

Ship it!

I think this looks right now

- Joseph Wenninger


On April 16th, 2014, 6:12 a.m. UTC, Magnus Hoff wrote:

Review request for Kate.
By Magnus Hoff.

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

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

  • 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

--===============7426699765524959251==-- --===============9092318452077250447== 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 --===============9092318452077250447==--