Skip to content

Add JSONiq and XQuery formatter support to language server - #48

Merged
CaiJimmy merged 35 commits into
mainfrom
formatter-v2
Aug 9, 2026
Merged

Add JSONiq and XQuery formatter support to language server#48
CaiJimmy merged 35 commits into
mainfrom
formatter-v2

Conversation

@CaiJimmy

@CaiJimmy CaiJimmy commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Adds a new Wadler-style formatter for JSONiq and XQuery.

It formats core queries, declarations, expressions, collections, scripting statements, and direct XML constructors with configurable indentation and line width. It preserves comments and whitespace-sensitive content such as XML text and string constructors.

The formatter only runs on valid documents and is covered by parse, idempotence, and regression tests.

CaiJimmy added 30 commits August 6, 2026 19:43
…g attribute handling and verbatim text support
…e formatting, enhancing code reuse and readability
…XQuery support

- Add `formatStringConstructor` function to handle string constructors with embedded expressions.
- Update `XQueryFormatterVisitor` to include support for formatting string constructors.
- Refactor comment attachment logic to improve handling of leading, trailing, and dangling comments.
- Remove unused blank line normalization functions and options from the formatter.
- Introduce new tests for comment attachments and document printing to ensure proper formatting behavior.
- Enhance existing tests to cover new formatting features and maintain semantic invariants across grammar families.
@changeset-bot

changeset-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d46c6d4

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

This PR includes changesets to release 2 packages
Name Type
jsoniq-language-server Minor
jsoniq-vscode 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

@CaiJimmy
CaiJimmy merged commit 2aa8734 into main Aug 9, 2026
3 checks passed
@CaiJimmy
CaiJimmy deleted the formatter-v2 branch August 9, 2026 12:17
@github-actions github-actions Bot mentioned this pull request Aug 9, 2026
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.

1 participant