From 1c639f781003accdcc43c6a167b29a02e5ff64f0 Mon Sep 17 00:00:00 2001 From: Gianni Chiappetta Date: Wed, 13 Jan 2021 21:24:56 -0500 Subject: [PATCH 2/6] feat(rc): improve graphql syntax highlighters --- rc/filetype/graphql.kak | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/rc/filetype/graphql.kak b/rc/filetype/graphql.kak index 5cb52464..430905b8 100644 --- a/rc/filetype/graphql.kak +++ b/rc/filetype/graphql.kak @@ -34,15 +34,39 @@ provide-module graphql %( add-highlighter shared/graphql regions add-highlighter shared/graphql/code default-region group -add-highlighter shared/graphql/string region '"' (?!)' bang:operator +add-highlighter shared/graphql/object/field/assignment regex '=' 0:operator + +# Keywords +add-highlighter shared/graphql/code/top-level regex '\bschema\b' 0:keyword +add-highlighter shared/graphql/code/keywords regex '\b(?enum|fragment|input|implements|interface|mutation|on|query|scalar|subscription|type|union)\h+(?:[A-Za-z]\w*)' name:keyword + +# Types +add-highlighter shared/graphql/object/field/scalars regex \b(Boolean|Float|ID|Int|String)\b 0:type + +# Operators +add-highlighter shared/graphql/object/field/expand-fragment regex '\.\.\.(?=\w)' 0:operator # Commands # ‾‾‾‾‾‾‾‾ From d8f65bd0ec8b27c2ce3db983b6cf1308f2818870 Mon Sep 17 00:00:00 2001 From: Gianni Chiappetta Date: Wed, 13 Jan 2021 21:31:29 -0500 Subject: [PATCH 3/6] feat(rc): match `.graphqls` file extension as graphql filetype --- rc/filetype/graphql.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/graphql.kak b/rc/filetype/graphql.kak index 430905b8..18a77d7a 100644 --- a/rc/filetype/graphql.kak +++ b/rc/filetype/graphql.kak @@ -4,7 +4,7 @@ # Detection # ‾‾‾‾‾‾‾‾‾ -hook global BufCreate .*[.](graphql) %{ +hook global BufCreate .*[.](graphqls?) %{ set-option buffer filetype graphql } From ec80d83e71e7e0d6c83ad7faed17a1cd5a2f48a6 Mon Sep 17 00:00:00 2001 From: Gianni Chiappetta Date: Wed, 13 Jan 2021 21:37:08 -0500 Subject: [PATCH 4/6] feat(rc): improve graphql field arguments highlighter --- rc/filetype/graphql.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/graphql.kak b/rc/filetype/graphql.kak index 18a77d7a..d704a23c 100644 --- a/rc/filetype/graphql.kak +++ b/rc/filetype/graphql.kak @@ -43,7 +43,7 @@ add-highlighter shared/graphql/object region -recurse \{ [{] [}] regions add-highlighter shared/graphql/object/line-description region '#' '\n' fill comment add-highlighter shared/graphql/object/block-description region '"""' '"""' fill comment add-highlighter shared/graphql/object/field default-region group -add-highlighter shared/graphql/object/field/ regex ([A-Za-z][A-Za-z0-9_-]*)(?:\([\w\d\h,:$=]*\))?\h*[:{] 1:attribute +add-highlighter shared/graphql/object/field/ regex ([A-Za-z][A-Za-z0-9_-]*)(?:\([\w\d\h,:$=!"_]*\))?\h*[:{] 1:attribute add-highlighter shared/graphql/object/field/ regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\h*$ 1:attribute # Values From 69a152d680caca6c602f0330c4fa874d28117f06 Mon Sep 17 00:00:00 2001 From: Gianni Chiappetta Date: Thu, 14 Jan 2021 11:40:17 -0500 Subject: [PATCH 5/6] chore(rc): change graphql block delimiters to support better regexs --- rc/filetype/graphql.kak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rc/filetype/graphql.kak b/rc/filetype/graphql.kak index d704a23c..ded58b80 100644 --- a/rc/filetype/graphql.kak +++ b/rc/filetype/graphql.kak @@ -27,7 +27,7 @@ hook -group graphql-highlight global WinSetOption filetype=graphql %{ } -provide-module graphql %( +provide-module graphql %§ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -43,7 +43,7 @@ add-highlighter shared/graphql/object region -recurse \{ [{] [}] regions add-highlighter shared/graphql/object/line-description region '#' '\n' fill comment add-highlighter shared/graphql/object/block-description region '"""' '"""' fill comment add-highlighter shared/graphql/object/field default-region group -add-highlighter shared/graphql/object/field/ regex ([A-Za-z][A-Za-z0-9_-]*)(?:\([\w\d\h,:$=!"_]*\))?\h*[:{] 1:attribute +add-highlighter shared/graphql/object/field/ regex ([A-Za-z][A-Za-z0-9_-]*)(?:\([^)]*\))?\h*[:{] 1:attribute add-highlighter shared/graphql/object/field/ regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\h*$ 1:attribute # Values @@ -96,4 +96,4 @@ define-command -hidden graphql-indent-on-new-line %< > > -) +§ From fe3f8d227179c46c6a3c5b78c84699ff6c4aa9cd Mon Sep 17 00:00:00 2001 From: Gianni Chiappetta Date: Thu, 14 Jan 2021 15:46:50 -0500 Subject: [PATCH 6/6] chore(rc): support nested field strings in graphql --- rc/filetype/graphql.kak | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rc/filetype/graphql.kak b/rc/filetype/graphql.kak index ded58b80..7ac16c07 100644 --- a/rc/filetype/graphql.kak +++ b/rc/filetype/graphql.kak @@ -49,7 +49,8 @@ add-highlighter shared/graphql/object/field/ regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\ # Values add-highlighter shared/graphql/object/field/values regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][+-]?\d*)?)\b 0:value add-highlighter shared/graphql/object/field/variables regex \$[a-zA-Z0-9]+\b 0:variable -add-highlighter shared/graphql/object/field/string regex '"[^"]*"' 0:string +# add-highlighter shared/graphql/object/field/string regex '"([^"]|\\")*"' 0:string +add-highlighter shared/graphql/object/field/string regex '"(?:[^"\\]|\\.)*"' 0:string # Meta add-highlighter shared/graphql/object/field/directives regex @(?:include|skip) 0:meta