D13787: CoffeeScript & JavaScript: fix member objects. Add .ts extension in JS

Nibaldo González noreply at phabricator.kde.org
Thu Jun 28 21:13:05 UTC 2018


nibags created this revision.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: kde-frameworks-devel.
nibags requested review of this revision.

REVISION SUMMARY
  **CoffeeScript**
  
  - Fix [bug #394365](URL "https://bugs.kde.org/show_bug.cgi?id=394365"):
  
  **Bug:** Identifiers with member objects are not highlighted. For example, when writing `timelineEvent.class`, `class` is highlighted as a Keyword, which sends a new context, showing an incorrect highlighting.
  
  **Solution:** Add a rule to detect identifiers of the type: `iden1.iden2.iden3`. The first word after a "." is highlighted as an identifier. However, the first word before a "." can be a keyword (as "globals").
  
  **JavaScript**
  
  - Fix [bug #366797](URL "https://bugs.kde.org/show_bug.cgi?id=366797"):
  
  **Bug:** When writing member objects (`iten1.iden2.iden3`), all text are highlighted after ".", including spaces. For example, `instanceof` and `Number` are highlighted as `Object Member`.
  
    object.property instanceof Number;
  
  **Solution:** Only the first word after `.` is highlighted as `Object member`.
  
  - Fix small bug in Shebang: multiple lines can be highlighted as Shebang (only the first line is considered Shebang).
  
  Example:
  
    #! shebang1
    #! shebang2
    #! shebang3
    ...
  
  **Others:**
  
  - CoffeeScript: Add mimetype `application/vnd.coffeescript`: http://dcjtech.info/topic/coffeescript-mimetype/
  
  - JavaScript: Add extension `*.ts` of TypeScript. TypeScript is a superset of JavaScript, therefore, the syntax highlighting is the same, except for some features that aren't in the JavaScript highlighter. Therefore, this may be temporary as long as there isn't a TypeScript highlighting file.
    - https://bugs.kde.org/show_bug.cgi?id=384716
  
  I also added a test file for CoffeeScript.

REPOSITORY
  R216 Syntax Highlighting

BRANCH
  fix-js-coffee

REVISION DETAIL
  https://phabricator.kde.org/D13787

AFFECTED FILES
  autotests/folding/test.coffee.fold
  autotests/folding/test.js.fold
  autotests/html/test.coffee.html
  autotests/html/test.js.html
  autotests/input/test.coffee
  autotests/input/test.js
  autotests/reference/test.coffee.ref
  autotests/reference/test.js.ref
  data/syntax/coffee.xml
  data/syntax/javascript.xml

To: nibags
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180628/45624bb7/attachment.html>


More information about the Kde-frameworks-devel mailing list