Skip to content

Makes the semantic analysis work with partial queries #519

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

Merged
merged 8 commits into from
Jun 16, 2025

Conversation

ncordon
Copy link
Collaborator

@ncordon ncordon commented May 30, 2025

What

Makes it possible to run the transpiled semantic analysis on unfinished queries:

Before we were getting only syntax errors on queries like:
only-syntax-errors

Now:
syntax-and-semantic-errors

How

It updates the semantic analysis artifacts that have already been modified to run the semantic analysis even if the AST would generate a null.

Copy link

changeset-bot bot commented May 30, 2025

🦋 Changeset detected

Latest commit: 7fcb568

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

@ncordon ncordon requested a review from anderson4j June 10, 2025 10:16
Copy link
Collaborator

@anderson4j anderson4j left a comment

Choose a reason for hiding this comment

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

Nice improvements! Only change I see that we need is to add a changeset.

Also, I was thinking it might be nice to link the PR where the actual changes happen in the main repo. That one is private however, so I wonder if we're still allowed to add a URL here?

@@ -337,7 +337,7 @@ describe('Semantic validation spec', () => {
]);
});

test('Does not trigger semantic errors when there are syntactic errors', () => {
test('Does not trigger semantic errors when there are irrecoverable syntactic errors', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the difference between an "irrecoverable" syntactic error and a "recoverable" one?

Im thinking something like "The semantic analysis is always run now, but when parsing the query breaks so early that antlr doesnt see the later clauses for what they are, there's nothing to analyze"?

In this case - parsing breaks on metch, and we never parse n and m as variables

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As I explained in a call: irrecoverable syntactic errors are those that would not produce any AST whatsoever

@ncordon ncordon merged commit 039d1c5 into main Jun 16, 2025
7 checks passed
@ncordon ncordon deleted the partial-semantic-analysis branch June 16, 2025 16:06
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