Repository navigation
Turtle formatter pretty - #35
Merged
Merged
Conversation
Layout decisions are now made while building a `pretty` document, and rendering is left to pretty's group/fits algorithm. Hard lines propagate breaks to enclosing groups, so nested multi-line blank nodes and collections lay out correctly without rewinding the output buffer. - single-PO blank nodes stay inline when they fit, else break after `[` - multi-PO blank nodes always break after `[` (Style knob) - collections stay inline when they fit, else one item per line - object lists of simple terms break all-or-nothing; lists containing nested structures keep `], [` together Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Formatting: - Point rdf-parsers at the local checkout (../rdf-parsers), which has the pretty-based generated formatters. - Turtle formats from the stored syntax tree with rdf-parsers' TurtleHook; a small hook on top keeps rewriting prefix/base declarations to the configured `prefix_format`. The hand-written formatter and its `pretty` dependency are gone. - TriG picks up the new formatter through the dependency. - SPARQL gets a format system: the parse stores the syntax tree on a clean parse, and formatting is opt-in via `format.sparql`. Config: - `format` moves into LocalConfig, so it also works from ~/.config/swls/config.json and .swls/config.json; later sources override the toggles they set. - Invalid initializationOptions are reported (log + client output) instead of silently resetting every setting. - README documents `format`, `prefix_format` and source precedence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`.ru` files hold SPARQL updates, which failed to parse as queries, so they showed false syntax errors and were never formatted. They are now parsed with the update grammar. Also covers the new N3 formatter from rdf-parsers with a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Turtle, TriG, SPARQL, N3 and JSON-LD now format unless disabled with `format.<language>: false`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
This fixes #34 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The biggest change is using the rdf-parsers formatters for turtle, trig, sparql and n3.