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

Authored by nibags on Jun 28 2018, 9:13 PM.

Details

Summary

CoffeeScript

  • BUG: 394365

Bug: Member objects are not highlighted. For example, when writing timelineEvent.class, class is highlighted as a Keyword, which sends a new context (in the example image, tl is highlighted as the class name and all the code after -overdue" is string). class should be highlighted as an Identifier, not as a keyword.

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 (like the keyword list: "globals"). (As a comparison, in Brackets & VS Code, the text after "." is highlighted differently).

JavaScript

  • BUG: 366797

Bug: When writing member objects (iten1.iden2.iden3), all identifiers and spaces after "." are highlighted with the "Object Member" attribute. For example, then property, instanceof & Number are highlighted as "Object Member".

Solution: Only the first word after . is highlighted as Object member.

  • Fix small bug: Multiple lines are highlighted as Shebang, which is an error, since only the first line is considered Shebang.

Example:

Others:

  • 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.

I also added a test file for CoffeeScript.

Diff Detail

Repository
R216 Syntax Highlighting
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nibags created this revision.Jun 28 2018, 9:13 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJun 28 2018, 9:13 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
nibags requested review of this revision.Jun 28 2018, 9:13 PM
nibags edited the summary of this revision. (Show Details)Jun 28 2018, 9:15 PM
nibags added reviewers: dhaumann, cullmann.
nibags edited subscribers, added: Framework: Syntax Highlighting; removed: kde-frameworks-devel.
nibags edited the summary of this revision. (Show Details)Jun 30 2018, 7:40 AM
nibags edited the summary of this revision. (Show Details)Jun 30 2018, 7:44 AM
nibags edited the summary of this revision. (Show Details)Jun 30 2018, 8:10 AM
nibags updated this revision to Diff 37154.Jul 4 2018, 4:59 PM

JavaScript: Add unicode escape \u{1234\}

nibags edited the summary of this revision. (Show Details)Jul 4 2018, 5:00 PM
dhaumann accepted this revision.Jul 6 2018, 6:16 AM

Can you update the comment? Besides that, looks good.

data/syntax/javascript.xml
6–8

The comment does not explain why it is temporary. I think it should note that it may be required to create a dedicated one over time for TypeScript.

This revision is now accepted and ready to land.Jul 6 2018, 6:16 AM
nibags updated this revision to Diff 37238.Jul 6 2018, 10:22 AM
  • Update comment
nibags edited the summary of this revision. (Show Details)Jul 14 2018, 3:55 AM
Restricted Application added a project: Kate. · View Herald TranscriptJul 14 2018, 3:55 AM
Restricted Application added a subscriber: kwrite-devel. · View Herald Transcript
This revision was automatically updated to reflect the committed changes.