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

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

Details

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.

Diff Detail

Repository
R216 Syntax Highlighting
Branch
fix-keys-include
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 5228
Build 5246: arc lint + arc unit
nibags created this revision.Nov 21 2018, 8:07 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptNov 21 2018, 8:07 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
nibags requested review of this revision.Nov 21 2018, 8:07 PM
nibags retitled this revision from Fix language load after including keywords from this language to Fix language load after including keywords from this language in another file.Nov 21 2018, 8:19 PM
cullmann accepted this revision.Nov 22 2018, 11:55 AM

Uh, good catch.

This revision is now accepted and ready to land.Nov 22 2018, 11:55 AM
nibags closed this revision.Nov 24 2018, 6:28 AM