-
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
Alter so labels with numbers and underscores dont get needless backticks #299
base: main
Are you sure you want to change the base?
Conversation
|
@@ -32,7 +32,7 @@ import { CompletionItem, Neo4jFunction, Neo4jProcedure } from '../types'; | |||
const uniq = <T>(arr: T[]) => Array.from(new Set(arr)); | |||
|
|||
function backtickIfNeeded(e: string): string | undefined { | |||
if (/\s/.test(e) || /[^a-zA-Z]/.test(e)) { | |||
if (/\s/.test(e) || /[^a-zA-Z0-9_]/.test(e)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an edge case we are not handling well here: a label, rel type or property key that starts with a number still needs backticks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also checked with chatGPT and apparently non-english letters is okay anywhere in the names, will fix both at the same time
4ede8ad
to
244dad4
Compare
Before if for example had relationship rel_123, we autocompleted
MATCH (n)-[:rel^]
toMATCH (n)-[:
`rel_123
`]
Now instead we dont backtick if we have underscore and numbers in label names/rel names/properties and just give
MATCH (n)-[:rel_123]