-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
please allow cypher to be selected for code highlighting in notebooks #275
Comments
Hello @na-wapf! This is a great request. Let us look into it and come back to you. If you think this could be contributed to the plugin easily, we are also very happy to receive contributions 😄 |
Thanks @ncordon :) I had another look at vs code... It seems like with the current VS Code extension API and I didn't see a way to contribute this functionality? Looks like you actually need to implement a kernel and install a kernel spec... the terminal command I think in practice implementing a wrapper kernel that can be installed using pip is fairly easy... see here Back on my current work-around i found a way to pass python variables from the local scope into cypher # con.py
from neo4j_keycloak_helper import Neo4jManager # custom wrapper
from neo4j.exceptions import CypherSyntaxError
from IPython.core.magic import register_cell_magic
from IPython.display import display
from IPython.core.getipython import get_ipython
@register_cell_magic
def cypher(line, cell):
ip = get_ipython()
if ip is None:
return
scope = ip.get_local_scope(2)
params = {key:scope.get(key) for key in line.split(" ")}
try:
_ = manager.read_pandas("\n"+cell, parameters=None if params=={} else params)
ip.push({"_":_})
except CypherSyntaxError as e:
print(e.message)
return
display(_)
manager = Neo4jManager(
neo4j_url = "neo4j+s://...:7687",
neo4j_database = "neo4j",
auth = ...
) Then from my notebooks; # test.ipynb [cell 1]
# import the manager object... don't need to use it though since the cell magic is installed
from con import manager # test.ipynb [cell 2]
%%cypher
MATCH ... RETURN ... |
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
But currently cypher does not show up in the options list;
I have been setting up a custom cell magic as follows:
First notebook cell:
Second notebook cell
This extension could be adjusted so that this next cell can have proper cypher syntax highlighting in vs code!
Third Notebook Cell
The text was updated successfully, but these errors were encountered: