From 8b2a240f2274e6e87a8d6200e7ba28cef37a65ab Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 9 Dec 2022 19:05:04 +0300 Subject: [PATCH] change highlights --- examples/twitter.d2 | 14 +++++++------- queries/highlights.scm | 12 +++++++++--- test/highlight/attribute.d2 | 17 +++++++++++++++++ test/highlight/shape.d2 | 8 ++++---- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/examples/twitter.d2 b/examples/twitter.d2 index c3e2128..8b20ea2 100644 --- a/examples/twitter.d2 +++ b/examples/twitter.d2 @@ -11,7 +11,7 @@ timeline mixer: "" { } People discovery: "People discovery \nservice" admixer: Ad mixer { - fill: "#c1a2f3" + style.fill: "#c1a2f3" } onboarding service: "Onboarding \nservice" @@ -55,7 +55,7 @@ Android: { web -> twitter fe timeline scorer: "Timeline\nScorer" { - fill: "#ffdef1" + style.fill: "#ffdef1" } home ranker: Home Ranker @@ -67,7 +67,7 @@ timeline mixer -> home ranker: { } timeline mixer -> timeline service home mixer: Home mixer { - # fill: "#c1a2f3" + # style.fill: "#c1a2f3" } container0.graphql -> home mixer: { style.stroke-dash: 4 @@ -94,7 +94,7 @@ prediction service2: Prediction Service { icon: https://cdn-icons-png.flaticon.com/512/6461/6461819.png } home scorer: Home Scorer { - fill: "#ffdef1" + style.fill: "#ffdef1" } manhattan: Manhattan memcache: Memcache { @@ -102,15 +102,15 @@ memcache: Memcache { } fetch: Fetch { - multiple: true + style.multiple: true shape: step } feature: Feature { - multiple: true + style.multiple: true shape: step } scoring: Scoring { - multiple: true + style.multiple: true shape: step } fetch -> feature diff --git a/queries/highlights.scm b/queries/highlights.scm index d983af3..302cf0c 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -8,11 +8,14 @@ ; Literals ;------------------------------------------------------------------------------- -(language) @string.special -(container_key (string) @string.special) +(language) @type.qualifier +(container_key (string) @string) (shape_key (string) @string) -(label) @string +(label) @string.special (attr_value) @string +(integer) @number +(float) @float +(boolean) @boolean ; Comments ;------------------------------------------------------------------------------- @@ -33,6 +36,9 @@ [ "{" "}" + "|" + "|`" + "`|" ] @punctuation.bracket ; Special (nvim-treesitter overwrite previous rules) diff --git a/test/highlight/attribute.d2 b/test/highlight/attribute.d2 index 58f878a..f870e2f 100644 --- a/test/highlight/attribute.d2 +++ b/test/highlight/attribute.d2 @@ -26,3 +26,20 @@ foo: Label { # ^ property } + +foo: { + style: { + opacity: 0.5 + # ^ float + fill: red + # ^ string + stroke: 'red' + # ^ string + stroke-width: 5 + # ^ number + shadow: true + # ^ boolean + animated: false + # ^ boolean + } +} diff --git a/test/highlight/shape.d2 b/test/highlight/shape.d2 index ef251c4..c0b279f 100644 --- a/test/highlight/shape.d2 +++ b/test/highlight/shape.d2 @@ -1,22 +1,22 @@ foo.'baz'.biz # <- constant # ^ punctuation.delimiter -# ^ string.special +# ^ string # ^ punctuation.delimiter # ^ variable 'biz': 'Baz' # <- string -# ^ string +# ^ string.special foo: Foo Bar # <- variable # ^ punctuation.delimiter -# ^ string +# ^ string.special foo: Foo Bar { # <- constant - # ^ string + # ^ string.special # ^ punctuation.bracket bar.baz