Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/sparql-1-2-formatter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@matdata/yasqe": minor
"@matdata/yasgui": patch
---

Format queries with [@matdata/sparql-formatter](https://github.com/Matdata-eu/sparql-formatter) instead of `sparql-formatter`. The new formatter supports SPARQL 1.2 (`VERSION`, triple terms `<<( ... )>>`, reified triples `<< ... ~ r >>`, reifiers and annotations `{| ... |}`, base direction and the new functions), so SPARQL 1.2 queries are now formatted instead of falling back to the legacy formatter. Comments keep their position when a query is formatted, including comments inside empty groups such as `GRAPH ?g { # comment }` ([sparqling/sparql-formatter#30](https://github.com/sparqling/sparql-formatter/issues/30)).

The formatter setting keeps its stored value (`sparql-formatter`), so saved settings are unchanged; the option is now labelled "SPARQL 1.2 Formatter".
2 changes: 1 addition & 1 deletion docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Keep your SPARQL queries clean and readable with automatic formatting.
- Format button in the editor toolbar
- Keyboard shortcut: `Shift+Ctrl+F`
- Choice of formatting engines:
- **sparql-formatter** (default): Standards-compliant, modern formatter
- **SPARQL 1.2 Formatter** (default): [@matdata/sparql-formatter](https://github.com/Matdata-eu/sparql-formatter), supports SPARQL 1.2 (triple terms, reifiers, annotations, `VERSION`, ...) and keeps comments where you put them
- **Legacy formatter**: Original MatGUI formatter
- Auto-format on query execution (configurable in Settings)

Expand Down
240 changes: 15 additions & 225 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/yasgui/src/TabSettingsModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ export default class TabSettingsModal {

const sparqlFormatterOption = document.createElement("option");
sparqlFormatterOption.value = "sparql-formatter";
sparqlFormatterOption.textContent = "SPARQL Formatter (external library)";
sparqlFormatterOption.textContent = "SPARQL 1.2 Formatter";
formatterSelect.appendChild(sparqlFormatterOption);

const legacyOption = document.createElement("option");
Expand Down
4 changes: 2 additions & 2 deletions packages/yasqe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
"@codemirror/state": "^6.7.2",
"@codemirror/view": "^6.43.10",
"@lezer/highlight": "^1.2.3",
"@matdata/sparql-formatter": "^1.1.0",
"@matdata/yasgui-utils": "^4.6.1",
"leaflet": "^1.9.4",
"lodash-es": "^4.17.15",
"query-string": "^6.10.1",
"sparql-formatter": "^1.0.2"
"query-string": "^6.10.1"
},
"devDependencies": {
"@types/leaflet": "^1.9.21",
Expand Down
Loading
Loading