Fix language load after including keywords from this language in another file

Authored by nibags on Nov 21 2018, 8:06 PM.

Description

Fix language load after including keywords from this language in another file

Summary:
When keywords are included from "X" language, the syntax highlighting of the "X" language will not be loaded:

  • The "IncludeRules" rule, from the "X" language, doesn't work.
  • It isn't possible to open files of the "X" language while the text editor is open.

For example, in the following code, <IncludeRules context="Escape##JavaScript" /> doesn't work.

<list name="keys">
    <include>reserved##JavaScript</include>
</list>

<contexts>
    <context name="Normal" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="Escape##JavaScript" />
        <IncludeRules context="##C" />
    </context>
    ...

Also, this bug can be noticed when opening a SCSS file and then a CSS file; the CSS file is not loaded, since SCSS includes CSS keywords.

This happens, because when, in DefinitionData, if keywordIsLoaded is true, the loadHighlighting(...) method is returned and doesn't read the content of the <highlighting> tag.

Reviewers: Framework: Syntax Highlighting, cullmann, dhaumann, vkrause, jpoelen

Reviewed By: Framework: Syntax Highlighting, cullmann

Subscribers: kwrite-devel, kde-frameworks-devel

Tags: Kate, Frameworks

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