sublime-cypher
sublime-cypher copied to clipboard
Cypher highlighting in JS / Coffeescript
I have a bunch of cypher in my coffee files inside strings.
Such as https://cloudup.com/c7mjpm5Cgbc
Would highlighting this code be possible?
It is possible, though I am not sure how to do it from within the cypher package.
In my own copy of sublimetext I changed the Python.tmLanguage
file. I first converted it to JSON and then searched for the inclusion of SQL markup within strings. I pretty much copied what was done for it and ended up with something like the following for cypher and it worked quite well:
{
"string_quoted_double": {
"patterns": [
...
{
"begin": "(')(?=\\s*(START|MATCH|RETURN|CREATE|DELETE|WHERE|WITH))",
"beginCaptures": {
"1": {
"name": "punctuation.definition.string.begin.python"
}
},
"comment": "single quoted string",
"end": "(')|(\\n)",
"endCaptures": {
"1": {
"name": "punctuation.definition.string.end.python"
},
"2": {
"name": "invalid.illegal.unclosed-string.python"
}
},
"name": "string.quoted.single.single-line.python",
"patterns": [
{
"include": "#constant_placeholder"
},
{
"include": "#escaped_char"
},
{
"include": "source.cypher"
}
]
},
...
}
}