TypeScript & TS/JS React: improve types detection, fix float-points & other…

Authored by nibags on Jan 3 2019, 7:56 PM.

Description

TypeScript & TS/JS React: improve types detection, fix float-points & other improvements/fixes

Summary:

Changes:

TypeScript:

  • Don't highlight built-in classes as functions. For example:
let a = Array(12);
  • Fix highlighting of floating points: the rules for detecting floating point aren't in correct order, so numbers like 1.E+3 aren't highlighted correctly.
  • Improved type detection, for example:
hello<string>
let d: string = "hello";
let a: null = null;

In that example, string will be highlighted as "Type/Primitive" only after : and between < and >. In the third line, the first null will be highlighted as "Type/Primitive" and the second null as "Keyword".

TypeScript React:

  • Adapt to the the changes of typescript.xml.

TypeScript React & JavaScript React:

  • Allow type assertion in the tag name, for example: <C<number> />
  • Allow tags after the keywords await & yield.
  • Allow empty tags: <></>.
  • Allow Non-ASCII characters in component tags.
  • Allow inserting code anywhere in a tag. Example: <tag b="hi" { code } />

Reviewers: Framework: Syntax Highlighting, dhaumann, cullmann

Reviewed By: Framework: Syntax Highlighting, dhaumann

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: Kate, Frameworks

Differential Revision: https://phabricator.kde.org/D17883