From 3276c45ba4738650cfbca11c82b117555dbd8995 Mon Sep 17 00:00:00 2001 From: "jonathan.casey" Date: Tue, 5 Sep 2023 16:13:50 +0100 Subject: [PATCH] feat(map): extends for Map Type Signed-off-by: jonathan.casey --- README.md | 1 + client/snippets/concerto.json | 5 ++ client/syntaxes/concerto.tmLanguage.json | 85 ++++++++++++++++++++++-- test-data/hr/hr.cto | 6 ++ 4 files changed, 93 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e561570..373108c 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ The extention adds code snippets for the following elements of the Concerto lang | Transaction | transaction | | Concept | concept | | Enum | enum | +| Map | map | | Scalar | scalar | | Event | event | | Namespace | namespace | diff --git a/client/snippets/concerto.json b/client/snippets/concerto.json index 0079713..4d5b014 100755 --- a/client/snippets/concerto.json +++ b/client/snippets/concerto.json @@ -41,6 +41,11 @@ "body": ["enum ${1:enumName} {", "\to ${2:ITEM}$0", "}"], "description": "Concerto enumerations define lists of static values" }, + "Map": { + "prefix": "map", + "body": ["map ${1:mapName} {", "\to ${2:ITEM}$0", "}"], + "description": "Concerto maps define a set of key-value pairs" + }, "Namespace": { "prefix": "namespace", "body": ["namespace ${1:org.accordproject.color@1.0.0} "], diff --git a/client/syntaxes/concerto.tmLanguage.json b/client/syntaxes/concerto.tmLanguage.json index d2463d0..428fa3c 100644 --- a/client/syntaxes/concerto.tmLanguage.json +++ b/client/syntaxes/concerto.tmLanguage.json @@ -53,7 +53,7 @@ }, "concerto-declaration": { "name": "keyword.control.flow.concerto", - "match": "\\b(asset|transaction|participant|enum|concept|event|scalar)\\b", + "match": "\\b(asset|transaction|participant|enum|map|concept|event|scalar)\\b", "patterns": [] }, "concerto-abstract-type": { @@ -463,6 +463,9 @@ { "include": "#enum-declaration" }, + { + "include": "#map-declaration" + }, { "include": "#namespace-declaration" }, @@ -504,7 +507,7 @@ "name": "entity.name.type.js" } }, - "end": "(?=[};]|\\bvar\\b|\\blet\\b|\\bconst\\b|\\btype\\b|\\bfunction\\b|\\bclass\\b|\\binterface\\b|\\bnamespace\\b|\\bmodule\\b|\\bimport\\b|\\benum\\b|\\bdeclare\\b|\\bexport\\b|\\babstract\\b|\\basync\\b)", + "end": "(?=[};]|\\bvar\\b|\\blet\\b|\\bconst\\b|\\btype\\b|\\bfunction\\b|\\bclass\\b|\\binterface\\b|\\bnamespace\\b|\\bmodule\\b|\\bimport\\b|\\benum\\b|\\bmap\\b|\\bdeclare\\b|\\bexport\\b|\\babstract\\b|\\basync\\b)", "patterns": [{ "include": "#comment" }, @@ -598,6 +601,80 @@ } ] }, + "map-declaration": { + "name": "meta.map.declaration.js", + "begin": "(?