ljos/sparql-mode

sparql-indent-offset variable does not affects blank nodes indention

Closed this issue · 5 comments

Ref #60

I found when I change sparql-indent-offset it does not affect indention within blank nodes. By default it always stay 2.

It would be great if blank nodes indention value would be negative. Maybe it is worth to create variable sparql-bnode-indent-offset.

ljos commented

What do you mean by the indentation value being negative? Can you show me an example?

ljos commented

I pushed a patch for the first part; the indentation of blank nodes is always 2.

File with example of the negative indention is attached with exmaple indent value -4. It is simply 4 spaces to the left from the nearest open bracket ([) column.

negative-indent.txt

ljos commented

Is this desirable? The way it is implemented now (especially with the latest patch) is the way that the specification formats blank nodes. I could see an argument for indenting blank nodes the same way as other parenthesis, so

select * where {
  ?row raw:hasParameterX ?param1 ;
  raw:hasParameterY ?param2 ;
  raw:hasReading [
    rdf:rest*/rdf:first [
      raw:unit ?unit ;
      rdf:value ?value ;
    ] ;
  ] .
}

Which would mean we just indent in according to previous indentation column instead the special case of blank nodes where the indentation is based on the column of the previous [. This could be configurable, but a negative indentation based on the column of [ feels strange to me.

Do you have a reason for wanting to do that? It could make it difficult in some instances where the negative indentation is further back than the current indentation.

@ljos No I do not have any special reason to have negative indentation. It seems your argumentation is correct: indentation should be based on the previous bracket not the current one.