From 675eae75521ecb25da2f1431d8f143bc026bdb05 Mon Sep 17 00:00:00 2001 From: "Rashid J. Almheiri" Date: Mon, 25 Nov 2024 21:50:50 +0400 Subject: [PATCH] feat(syntaxes): linguist compatibility --- package.json | 5 +++++ syntaxes/atd.json | 4 +++- syntaxes/cram.json | 22 ++++++++++++++++------ syntaxes/dune-all.json | 11 +++++++++++ syntaxes/dune.json | 24 ++++++++++++------------ syntaxes/menhir.json | 34 +++++++++++++++++----------------- syntaxes/ocaml.json | 12 ++++++------ syntaxes/ocamlbuild.json | 12 ++++++------ syntaxes/ocamllex.json | 8 ++++++-- 9 files changed, 82 insertions(+), 50 deletions(-) create mode 100644 syntaxes/dune-all.json diff --git a/package.json b/package.json index fba5adcac..d6bbc2a28 100644 --- a/package.json +++ b/package.json @@ -592,6 +592,11 @@ "scopeName": "source.dune-workspace", "path": "./syntaxes/dune-workspace.json" }, + { + "language": "dune-all", + "scopeName": "source.dune-all", + "path": "./syntaxes/dune-all.json" + }, { "language": "ocaml.merlin", "scopeName": "source.ocaml.merlin", diff --git a/syntaxes/atd.json b/syntaxes/atd.json index dc091edeb..09d6d692a 100644 --- a/syntaxes/atd.json +++ b/syntaxes/atd.json @@ -22,7 +22,9 @@ "1": { "name": "keyword.other.atd" }, "2": { "name": "keyword.other.atd" } }, - "endCaptures": [{ "name": "keyword.other.atd" }], + "endCaptures": { + "1": { "name": "keyword.other.atd" } + }, "patterns": [{ "include": "$self" }] } ] diff --git a/syntaxes/cram.json b/syntaxes/cram.json index b512dc19e..e59928691 100644 --- a/syntaxes/cram.json +++ b/syntaxes/cram.json @@ -135,24 +135,34 @@ { "begin": "\\[\\^?", "end": "\\]", - "beginCaptures": [{ "name": "keyword.other.regex" }], - "endCaptures": [{ "name": "keyword.other.regex" }], + "beginCaptures": { + "1": { "name": "keyword.other.regex" } + }, + "endCaptures": { + "1": { "name": "keyword.other.regex" } + }, "contentName": "source.regex", "patterns": [{ "name": "keyword.other.regex", "match": "-" }] }, { "begin": "\\((\\?[:=!])?", "end": "\\)", - "beginCaptures": [{ "name": "keyword.other.regex" }], - "endCaptures": [{ "name": "keyword.other.regex" }], + "beginCaptures": { + "1": { "name": "keyword.other.regex" } + }, + "endCaptures": { + "1": { "name": "keyword.other.regex" } + }, "contentName": "source.regex", "patterns": [{ "include": "#regex" }] }, { "begin": "{", "end": "}", - "beginCaptures": [{ "name": "keyword.other.regex" }], - "endCaptures": [{ "name": "keyword.other.regex" }], + "beginCaptures": { + "1": { "name": "keyword.other.regex" } + }, + "endCaptures": { "1": { "name": "keyword.other.regex" } }, "contentName": "source.regex", "patterns": [ { diff --git a/syntaxes/dune-all.json b/syntaxes/dune-all.json new file mode 100644 index 000000000..07a95d150 --- /dev/null +++ b/syntaxes/dune-all.json @@ -0,0 +1,11 @@ +{ + "name": "dune-all", + "scopeName": "source.dune-all", + "fileTypes": ["dune", "dune-project", "dune-workspace"], + "patterns": [ + { "include": "source.dune#general" }, + { "include": "source.dune#stanzas" }, + { "include": "source.dune-project#stanzas" }, + { "include": "source.dune-workspace#stanzas" } + ] +} diff --git a/syntaxes/dune.json b/syntaxes/dune.json index a93279e28..8851e3239 100644 --- a/syntaxes/dune.json +++ b/syntaxes/dune.json @@ -2788,16 +2788,16 @@ "comment": "variable", "begin": "%\\{", "end": "\\}", - "beginCaptures": [ - { + "beginCaptures": { + "1": { "name": "keyword.operator.dune" } - ], - "endCaptures": [ - { + }, + "endCaptures": { + "1": { "name": "keyword.operator.dune" } - ], + }, "patterns": [ { "include": "#variables" @@ -2876,16 +2876,16 @@ "comment": "escaped variable", "begin": "(\\%\\{)", "end": "(\\})", - "beginCaptures": [ - { + "beginCaptures": { + "1": { "name": "constant.character.escape.dune" } - ], - "endCaptures": [ - { + }, + "endCaptures": { + "1": { "name": "constant.character.escape.dune" } - ], + }, "patterns": [ { "include": "#variables" diff --git a/syntaxes/menhir.json b/syntaxes/menhir.json index 5f6d8757e..4d4f4a7f6 100644 --- a/syntaxes/menhir.json +++ b/syntaxes/menhir.json @@ -13,9 +13,9 @@ { "comment": "sequence of rules", "begin": "%%", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "%%", - "endCaptures": [{ "name": "keyword.other.menhir" }], + "endCaptures": { "1": { "name": "keyword.other.menhir" } }, "patterns": [{ "include": "#comments" }, { "include": "#rules" }] }, { "include": "source.ocaml" } @@ -44,15 +44,15 @@ { "comment": "ocaml header", "begin": "%{", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "%}", - "endCaptures": [{ "name": "keyword.other.menhir" }], + "endCaptures": { "1": { "name": "keyword.other.menhir" } }, "patterns": [{ "include": "source.ocaml" }] }, { "comment": "token declaration", "begin": "%token\\b", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "(?=%)", "patterns": [ { "include": "#type-annotation" }, @@ -65,7 +65,7 @@ { "comment": "associativity declaration", "begin": "%(?:nonassoc|left|right)\\b", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "(?=%)", "patterns": [ { "include": "#token-name" }, @@ -78,7 +78,7 @@ { "comment": "type/start/on_error_reduce declaration", "begin": "%(?:type|start|on_error_reduce)\\b", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "(?=%)", "patterns": [ { "include": "#type-annotation" }, @@ -96,7 +96,7 @@ { "comment": "attribute declaration", "begin": "%(?:attribute\\b|(?=\\[))", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "(?=%)", "patterns": [ { "include": "source.ocaml#attributes" }, @@ -113,8 +113,8 @@ "comment": "ocaml type annotation for token", "begin": "<", "end": ">", - "beginCaptures": [{ "name": "keyword.other.menhir" }], - "endCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, + "endCaptures": { "1": { "name": "keyword.other.menhir" } }, "patterns": [{ "include": "source.ocaml" }] } } @@ -167,7 +167,7 @@ { "comment": "production", "begin": "[:|]", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "(?=[{<|]|let\\b|[[:lower:]_][[:word:]]*[[:space:]]*(?:\\([^)]+\\)[[:space:]]*)?:|%(?!prec\\b))", "patterns": [ { "include": "#comments" }, @@ -214,7 +214,7 @@ { "comment": "production", "begin": "[:|]", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "(?=[{<|]|let\\b|[[:lower:]_][[:word:]]*[[:space:]]*(?:\\([^)]+\\)[[:space:]]*)?:|%(?!prec\\b))", "patterns": [ { "include": "#comments" }, @@ -238,9 +238,9 @@ "comment": "ocaml semantic action", "contentName": "source.embedded-action.menhir", "begin": "{", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": "}", - "endCaptures": [{ "name": "keyword.other.menhir" }], + "endCaptures": { "1": { "name": "keyword.other.menhir" } }, "patterns": [{ "include": "source.ocaml" }] }, "new-actions": { @@ -249,9 +249,9 @@ { "comment": "point-free ocaml semantic action", "begin": "<", - "beginCaptures": [{ "name": "keyword.other.menhir" }], + "beginCaptures": { "1": { "name": "keyword.other.menhir" } }, "end": ">", - "endCaptures": [{ "name": "keyword.other.menhir" }], + "endCaptures": { "1": { "name": "keyword.other.menhir" } }, "patterns": [{ "include": "source.ocaml" }] } ] @@ -279,7 +279,7 @@ }, { "comment": "destructured semantic value capture", - "begin": "(?", - "beginCaptures": [{ "name": "keyword.operator.ocamlbuild" }], - "endCaptures": [{ "name": "keyword.operator.ocamlbuild" }], + "beginCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } }, + "endCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } }, "name": "string.quoted.double.ocamlbuild", "patterns": [{ "include": "#patterns" }] }, @@ -65,8 +65,8 @@ { "begin": "{", "end": "}", - "beginCaptures": [{ "name": "keyword.operator.ocamlbuild" }], - "endCaptures": [{ "name": "keyword.operator.ocamlbuild" }], + "beginCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } }, + "endCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } }, "patterns": [ { "name": "keyword.operator.ocamlbuild", "match": "," }, { "include": "#patterns" } @@ -75,8 +75,8 @@ { "begin": "\\[\\^?", "end": "\\]", - "beginCaptures": [{ "name": "keyword.operator.ocamlbuild" }], - "endCaptures": [{ "name": "keyword.operator.ocamlbuild" }] + "beginCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } }, + "endCaptures": { "1": { "name": "keyword.operator.ocamlbuild" } } } ] }, diff --git a/syntaxes/ocamllex.json b/syntaxes/ocamllex.json index 4fc8b90a6..21472ac70 100644 --- a/syntaxes/ocamllex.json +++ b/syntaxes/ocamllex.json @@ -67,9 +67,13 @@ { "comment": "embedded ocaml source", "begin": "{", - "beginCaptures": [{ "name": "keyword.other.ocamllex" }], + "beginCaptures": { + "1": { "name": "keyword.other.ocamllex" } + }, "end": "}", - "endCaptures": [{ "name": "keyword.other.ocamllex" }], + "endCaptures": { + "1": { "name": "keyword.other.ocamllex" } + }, "patterns": [{ "include": "source.ocaml" }] } ]