scribble icon indicating copy to clipboard operation
scribble copied to clipboard

scribble indenter should not invade the textual part of at-expressions

Open mbutterick opened this issue 9 years ago • 4 comments

Before indentation:

#lang scribble/text
@list{
foo
}

After:

#lang scribble/text
@list{
 foo
}

Note the space inserted before "foo", which changes the data represented by this at-expression. Since whitespace is meaningful inside curly braces, the indenter should always leave those sections alone.

mbutterick avatar Oct 10 '16 18:10 mbutterick

It turns out that indenting doesn't change the content of the at-expression, because the at-reader is defined to discard any leading whitespace that appears on all lines.

mflatt avatar Oct 10 '16 18:10 mflatt

A better example, perhaps:

#lang at-exp racket
@list|{
{
bar
}
}|
'("{" "\n" "bar" "\n" "}")

Gets indented like so:

#lang at-exp racket
@list|{
 {
 bar
}
 }|

Which changes the result:

'(" " "{" "\n" " " "bar" "\n" "}")

mbutterick avatar Oct 10 '16 18:10 mbutterick

Of course, I can use a here-string instead (the indenter seems to leave those alone). Maybe the more specific problem here is that the indenter is mishandling the special case of alternate curly delimiters.

mbutterick avatar Oct 10 '16 19:10 mbutterick

Yeah, the whole point of the @-syntax is that tools (like indenters) can invade the text part, but only if the relative indentation in there isn't changed -- but in the last example you have it does indeed change that. It also looks broken with plain {} delimiters: it looks like it's indenting the text inside nested braces by one space.

elibarzilay avatar Oct 11 '16 03:10 elibarzilay