Open vemonet opened 6 days ago
Hey @vemonet, fair point. To be perfectly honest with you, i mainly implemented this to test tree-sitter queries and thought it was "cool".
One of the next things i would like to do is create a user-configuration. I'll add "align predicates" as a configurable option. Then we can argue about what the default should be :) Are there already other things about the formatter that you would like to have customizable?
Yes it is quite cool indeed :) I'll make my list to Santa Claus then!
I don't know if it is worth to go to configuration but WHERE {
should go to a newline imo
For configuration I could see these maybe:
WHERE
when it is not thereIf it is possible: automatically concatenate all predicates that are under the same subject, and all objects that are under the same predicate. So these patterns:
?hgnc up:database <http://purl.uniprot.org/database/HGNC> .
?hgnc up:database <http://purl.uniprot.org/database/OMA> .
?hgnc rdfs:comment ?hgncSymbol .
Would become:
?hgnc up:database <http://purl.uniprot.org/database/HGNC>, <http://purl.uniprot.org/database/OMA> ;
rdfs:comment ?hgncSymbol .
That would be so good! (should not break the boundaries of subqueries obviously)
fyi I tried pipx install fichu
(cool name!) and currently getting:
fichu format ./query.rq
thread 'main' panicked at src/main.rs:39:6:
called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)
Nice, thanks for the input!
Some of the suggestions, like the conversion of URIs (thanks for the CURIEs hint btw, looks awesome), sound more like Code Actions to me.
I think i want formatting only to "move" the tokens and not add, delete or reorder anything (but whitespace). More complex refactor operations would then be split into separate code actions.
fyi I tried pipx install fichu (cool name!) and currently getting:
fichu format ./query.rq thread 'main' panicked at src/main.rs:39:6: called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)
The bug should have been fixed in 0.1.7
.
Hi, currently the formatting of SPARQL queries aligns predicates/objects based on the length of the subject, e.g.:
Would it be possible to consider just going to the line and adding a regular indent? e.g.
I know it might seems like "a personal preference" but I think their are a few objective arguments for going for the regular indent approach:
black
/ruff-format
in python,prettier
/rome
/biome
in javascript, and rustfmt. Maybe there is a reason for that :)