Skip to content

Commit

Permalink
JSONSelectionString
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Oct 28, 2024
1 parent d0d2c77 commit ab78a30
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
43 changes: 43 additions & 0 deletions syntaxes/connectors.jsonselection.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,49 @@
"name": "punctuation.comma.LitArray.separator"
}
]
},
"JSONSelectionString": {
"contentName": "string.quoted.JSONSelectionString",
"begin": "((\"))",
"beginCaptures": {
"1": {
"name": "string.quoted.double.graphql"
},
"2": {
"name": "punctuation.definition.string.begin.graphql"
}
},
"end": "((\"))",
"endCaptures": {
"1": {
"name": "string.quoted.double.graphql"
},
"2": {
"name\"": "punctuation.definition.string.end.graphql"
}
},
"patterns": [
{
"name": "meta.JSONSelectionString.embedded",
"begin": "\\s*({)",
"beginCaptures": {
"1": {
"name": "punctuation.JSONSelectionString.open"
}
},
"end": "\\s*(})",
"endCaptures": {
"1": {
"name": "punctuation.JSONSelectionString.close"
}
},
"patterns": [
{
"include": "#PathSelection"
}
]
}
]
}
}
}
28 changes: 28 additions & 0 deletions syntaxes/connectors.jsonselection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,31 @@ repository:
# SpacesOrComments ::= (Spaces | Comment)+
# Spaces ::= ("⎵" | "\t" | "\r" | "\n")+
# Comment ::= "#" [^\n]*

# additional rules used for strings, e.g. in `POST: "/foo/bar/{$id}"`
JSONSelectionString:
contentName: string.quoted.JSONSelectionString
begin: '(("))'
beginCaptures:
"1":
name: "string.quoted.double.graphql"
"2":
name: "punctuation.definition.string.begin.graphql"
end: '(("))'
endCaptures:
"1":
name: "string.quoted.double.graphql"
"2":
name": "punctuation.definition.string.end.graphql"
patterns:
- name: "meta.JSONSelectionString.embedded"
begin: "\\s*({)"
beginCaptures:
"1":
name: "punctuation.JSONSelectionString.open"
end: "\\s*(})"
endCaptures:
"1":
name: "punctuation.JSONSelectionString.close"
patterns:
- include: "#PathSelection"
18 changes: 18 additions & 0 deletions syntaxes/graphql.connectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"patterns": [
{ "include": "source.graphql#graphql-comment" },
{ "include": "#connect-jsonselection-argument" },
{ "include": "#connect-string-jsonselection-argument" },
{
"begin": "\\s*(http)(?:\\s*(:))",
"end": "(?=\\s*(?:(?:([_A-Za-z][_0-9A-Za-z]*)\\s*(:))|\\)))|\\s*(,)",
Expand Down Expand Up @@ -85,6 +86,23 @@
},
{ "include": "source.graphql#graphql-skip-newlines" }
]
},
"connect-string-jsonselection-argument": {
"name": "meta.argument.connect.string.jsonselection.graphql",
"contentName": "meta.embedded.block.string.jsonselection.graphql",
"begin": "\\s*(GET|POST)(?:\\s*(:))",
"end": "(?=\\s*(?:(?:([_A-Za-z][_0-9A-Za-z]*)\\s*(:))|[\\)}]))|\\s*(,)",
"beginCaptures": {
"1": { "name": "variable.parameter.graphql" },
"2": { "name": "punctuation.colon.graphql" }
},
"endCaptures": {
"3": { "name": "punctuation.comma.graphql" }
},
"patterns": [
{ "include": "source.apollo.jsonselection#JSONSelectionString" },
{ "include": "source.graphql#graphql-skip-newlines" }
]
}
}
}

0 comments on commit ab78a30

Please sign in to comment.