YAML: only comments after spaces and other improvements/fixes
ClosedPublic

Authored by nibags on May 25 2019, 8:17 PM.

Details

Summary

BUG: 407060
FIXED-IN: 5.59.0

Improvements and corrections to YAML.

Changes:

  • Only highlight comments after spaces.
  • Add folding indentation, like the Python highlighter.
  • Avoid highlighting lists, hashes and strings within blocks with multiple lines, incorrectly.
  • Highlight two points of Keys in another color, to make it easier to differentiate Keys and attributes in some color schemes.
  • Changes in colors:
    • The Keys are now in bold, helps to differentiate Keys and attributes, especially in the Solarized schemes.
    • Data types are highlighted with dsOthers, to differentiate from the Attribute color.
    • "Normal Text" is now dsAttribute, to unify the colors of attributes, since in attributes with multiple lines the colors are inconsistent. This is done according to other text editors such as VSCode and Atom, where the same color is used for attributes and normal text.

Solarized scheme:

Normal block & literal block:

Diff Detail

Repository
R216 Syntax Highlighting
Branch
improve-yaml
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12291
Build 12309: arc lint + arc unit
nibags created this revision.May 25 2019, 8:17 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptMay 25 2019, 8:17 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
nibags requested review of this revision.May 25 2019, 8:17 PM
dhaumann accepted this revision.May 25 2019, 9:25 PM
This revision is now accepted and ready to land.May 25 2019, 9:25 PM
nibags updated this revision to Diff 58936.May 31 2019, 11:06 AM
  • Some fixes in attributes and update test file
nibags edited the summary of this revision. (Show Details)May 31 2019, 11:08 AM
cullmann accepted this revision.May 31 2019, 11:14 AM

Screenshots look better!

Btw., would it be possible to remove the hardcoded color here: <itemData name="Alert" defStyleNum="dsAlert" backgroundColor="#EF9A9A" />

Btw., would it be possible to remove the hardcoded color here: <itemData name="Alert" defStyleNum="dsAlert" backgroundColor="#EF9A9A" />

That I added it in a previous commit; use hard background color to mark indentation with Tabs in some situations (specifically, in the indentation capture with dynamic rules), since YAML uses indentation with spaces. And in Solarized schemes, dsAlert has no background color.

Hmm, ok, anyways, this change looks ok =)
Could one adapt the theme and remove the color later?

Could one adapt the theme and remove the color later?

Yes, it would be ideal, so there is consistency among all the themes

nibags closed this revision.May 31 2019, 6:58 PM