-
Notifications
You must be signed in to change notification settings - Fork 11
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
Adds formatting capabilities to vs-code extension #402
Adds formatting capabilities to vs-code extension #402
Conversation
|
@@ -12,6 +12,7 @@ Our extension preview provides a rich set of features for working with Cypher, t | |||
- Syntax checking - both simple and semantic errors (e.g. type errors, unknown labels, etc) | |||
- Autocompletion for Cypher keywords, functions, labels, properties, database names and more | |||
- Signature help for functions - shows the signature of the function while typing | |||
- Formatting - format the document according to the Cypher styleguide |
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.
🎉
Really cool to see the queries get automatically formatted on save, however I couldn't get this one to work and I don't understand why (since i get no syntax errors):
Logs say:
|
Hmm I can not get it to work either, will look into it before merge! |
I traced this to a issue with the formatter itself, I am getting the same issue running this in codemirror. I have added a Trello card for this. So I dont think this is related to this PR. |
The query above errors because of an issue in |
visitMergeClause = (ctx: MergeClauseContext) => { | ||
handleMergeClause( | ||
ctx, | ||
(node) => this.visit(node), | ||
() => this.startGroupAlsoOnComment(), | ||
(id) => this.endGroup(id), | ||
() => this.avoidBreakBetween(), | ||
); | ||
this.visit(ctx.MERGE()); | ||
this.avoidBreakBetween(); | ||
const patternGrp = this.startGroupAlsoOnComment(); | ||
this.visit(ctx.pattern()); | ||
this.endGroup(patternGrp); | ||
const n = ctx.mergeAction_list().length; | ||
for (let i = 0; i < n; i++) { | ||
this.visit(ctx.mergeAction(i)); | ||
} | ||
}; |
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.
I assume this is not part of this pr right? Not sure why it's still showing in the diff if it was merged to main
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.
No it is definitely not. Not sure why this is here at all. I merged main into this PR and after that it dissapeared. So i guess I was just not up to date with main.
@@ -69,7 +69,7 @@ export async function testSyntaxValidation({ | |||
); | |||
} | |||
|
|||
suite.only('Syntax validation spec', () => { |
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 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.
It'd make sense to clean up the history if you could before merge so the diff shows only the relevant changes
Will definitely do that. Merge main into this branch sorted things out. |
Description
This PR adds a document formatting endpoint to the language server package, allowing clients to request document formatting. It also sets the flag that the server is capable of formatting a document.
Updates the vs-code extension README to include the added formatting feature.
Initially, we investigated implementing cursor position tracking using our internal cursor tracking, but discovered that VS Code already handles cursor position updates automatically. Therefore, no additional logic was needed for cursor position management.