Skip to content

Expand formatter coverage#675

Merged
anderson4j merged 19 commits into
mainfrom
fixFormatting
May 11, 2026
Merged

Expand formatter coverage#675
anderson4j merged 19 commits into
mainfrom
fixFormatting

Conversation

@anderson4j

@anderson4j anderson4j commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Things have been busy over the past couple of months, and the formatter has not been kept up to date with recent grammar updates. In addition, it seems like some old syntax like CREATE DATABASE was not covered. This PR is to fix this, updating the formatter and adding test with example syntax.

Closes LS-145

…ix test of vector_norm test, manual addition of createAlias/createDb handling + testing
@changeset-bot

changeset-bot Bot commented Apr 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f93aec7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@neo4j-cypher/language-support Patch
@neo4j-cypher/language-server Patch
@neo4j-cypher/lint-worker Patch
@neo4j-cypher/query-tools Patch
@neo4j-cypher/react-codemirror-playground Patch
@neo4j-cypher/react-codemirror Patch

Not sure what this means? Click here to learn what changesets are.

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

@OskarDamkjaer OskarDamkjaer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting changes good to go, the claude changes would be nice to pair on or take in another PR

Comment thread .gitignore Outdated
*.npmrc
benchmarks.txt
.idea/
.claude/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git-ignoring this one but commiting CLAUDE.md?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it could be interesting to add some skills/etc to the repo, for new contributors, or for automated code review? Let's discuss later in our 121?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we said in 1-2-1 I agree. Will clean up this PR when it's ready for a full review

Comment thread CLAUDE.md Outdated
@@ -0,0 +1,109 @@
# CLAUDE.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a shared claude.md would be a good idea, but I think it'd be nice to collaborate on it. I found some of the best practises from anthropic counter intuitive:

https://code.claude.com/docs/en/best-practices#write-an-effective-claude-md

They say to exclude for example anything Claude can figure out by reading code.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


test('show indexes with where and return', () => {
const query = `SHOW INDEXES YIELD aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa
const query = `SHOW INDEXES

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you find the queries we fail to format? I'm thinking it could be nice if we could find them automatically? Perhaps we could extract samples from the main repos tests?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, ive discussed this with some surface people before, and they mentioned some .feature files that often contain queries with new syntax. I've made a card here

@anderson4j anderson4j left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are some replies to your comments. I still have a few months of changes to the grammar left, so I'll fix that first before a re-review


test('show indexes with where and return', () => {
const query = `SHOW INDEXES YIELD aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa
const query = `SHOW INDEXES

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, ive discussed this with some surface people before, and they mentioned some .feature files that often contain queries with new syntax. I've made a card here

Comment thread .gitignore Outdated
*.npmrc
benchmarks.txt
.idea/
.claude/

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like we said in 1-2-1 I agree. Will clean up this PR when it's ready for a full review

Comment thread CLAUDE.md Outdated
@@ -0,0 +1,109 @@
# CLAUDE.md

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
}

_emitResidualErrorNodes = () => {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a check to emit missed error nodes when visiting a terminal node. The one case we missed was when the error node was in the end. This change is to emit the leftover error nodes too.

@anderson4j

anderson4j commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

To find new syntax we hadn't covered I checked changes to the Cypher25Parser.g4 file in he monorepo.

To then figure how it should be formatted I checked what PRs the changes were for and checked what the canonical syntax looked like for this feature in the corresponding CIPs. I also checked the cypher styling guide for the general formatting rules.

@OskarDamkjaer OskarDamkjaer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@anderson4j anderson4j merged commit 0b2d441 into main May 11, 2026
14 checks passed
@anderson4j anderson4j deleted the fixFormatting branch May 11, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants