Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Cypher highlighting in JS / Coffeescript #9

Open
ncammarata opened this issue Jun 16, 2014 · 1 comment
Open

Cypher highlighting in JS / Coffeescript #9

ncammarata opened this issue Jun 16, 2014 · 1 comment

Comments

@ncammarata
Copy link

I have a bunch of cypher in my coffee files inside strings.

Such as https://cloudup.com/c7mjpm5Cgbc

Would highlighting this code be possible?

@kollhof
Copy link
Owner

kollhof commented Jun 17, 2014

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"
                }
            ]
        },

        ...
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants