Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

anderson4j
Copy link
Collaborator

@anderson4j anderson4j commented Nov 27, 2024

Before if for example had relationship rel_123, we autocompleted MATCH (n)-[:rel^] to
MATCH (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]

@anderson4j anderson4j added the auto completion Issues related to the auto-completion label Nov 27, 2024
Copy link

changeset-bot bot commented Nov 27, 2024

⚠️ No Changeset found

Latest commit: 244dad4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -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)) {
Copy link
Collaborator

@ncordon ncordon Nov 28, 2024

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

Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto completion Issues related to the auto-completion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants