Skip to content

please allow cypher to be selected for code highlighting in notebooks #275

@na-wapf

Description

@na-wapf

Hey there :)!

If possible may we please have cypher as a selectable language option in VS Code notebooks (.ipynb files).

We can already run cypher in notebook cells (see further below to see how!),
It is just that the code syntax highlighting is not available!

VS Code lets you manually set the language by clicking here
image

But currently cypher does not show up in the options list;
image

I have been setting up a custom cell magic as follows:


First notebook cell:

from IPython.core.magic import register_cell_magic
from neo4j import Neo4jDriver
import pandas as pd


def read_pandas(cypher:str) -> pd.DataFrame:
    # ... see https://neo4j.com/docs/python-manual/current/transformers/#_transform_to_pandas_dataframe

_ = None

@register_cell_magic
def cypher(line, cell):
    global _
    _ = read_pandas(cell) 
    display(_)

Second notebook cell
This extension could be adjusted so that this next cell can have proper cypher syntax highlighting in vs code!

%%cypher
RETURN "Hello Neo4j!" as result
         result
0  Hello Neo4j!

Third Notebook Cell

print("The first result was "+_.iloc[0,0])
The first result was Hello Neo4j!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions