Open JefWight opened 2 years ago
Thanks for taking the time to do such a detailed write-up!
There are currently limitations in the db.schema
(not always 100% correct, no node/rel properties) and the cypher-editor support (outdated parser, poorly maintained code) that make make perfect completion impossible.
But we shouldn't let perfect be the enemy of good (or decent in this case), so we're currently working on renewing the cypher-editor
repo and pushing for improvements in the schema methods. So we're working on it but the more extensive changes will take time
Description
When writing a query in the browser, filter autocomplete suggestions down to valid values based on the database schema.
Reproduce Steps
Using the sample Movie DBMS, start typing "MATCH (:Movie)-(:". Upon typing ":" autocomplete pops up suggestions:
Unfortunately, not all of the suggestions are valid. We can see this with a db.schema.visualization() call:
FOLLOWS is only ever found in the db between (:Person) nodes.
Same issue applies to property names:
This issue obviously affects databases with a large number of Labels, RelationshipTypes, and distinct Properties far worse than something as simple as the Movies DB.
Sidenote, there may also be a simpler bug with single letter variables when plugins like apoc are installed:
Can you propose a solution?
First part would be to make the metaQuery (currently in dbMetaDuck.ts) return something more like the db.schema.* function responses where relationships and properties contain metadata about valid nodes/labels.
The second (more extensive) part requires a change in neo4j-contrib/cypher-editor.
Additional Information
Was mentioned at the end of #135.