I think you could make it easier for everyone no matter what’s the indent 
preference is, spaces, tabs or even mixed. The closing """ delimiter determine 
the indent for every line before it. Basically it will always look at the 
beginning of that line and take all space characters (except escaped ones) 
until it find first non spacing character or itself.

"""\↵
····a\↵
····b\↵
····c··"""

// result

abc··
Mixed:

"""\↵
·⇥⇥·a\↵
·⇥⇥·b\↵
·⇥⇥·c··"""

// result

abc··
"""\↵
·⇥⇥·a\↵
·⇥⇥·b\↵
·⇥⇥·c··\↵
"""

// result

·⇥⇥·a·⇥⇥·b·⇥⇥·c··
"""\↵
·⇥⇥·a\↵
·⇥⇥·b\↵
·⇥⇥·c··\↵
·⇥"""

// result

⇥·a⇥·b⇥·c··
"""\↵
·⇥⇥·a\↵
·⇥⇥·b\↵
·⇥⇥·c··\↵
·⇥··"""

// shows 3 warning for the line with `a`, `b` and `c`
// fix-it to replace `⇥·` with `··`


-- 
Adrian Zubarev
Sent with Airmail

Am 11. April 2017 um 19:06:01, Adrian Zubarev ([email protected]) 
schrieb:

Can you elaborate a small example please, so I can better understand what you 
asked for?



-- 
Adrian Zubarev
Sent with Airmail

Am 11. April 2017 um 18:51:45, Ricardo Parada ([email protected]) schrieb:



Hi Adrian,

I think having the closing """ on a line by itself activates the indentation 
stripping feature. So if it was to change as you suggest then how would you 
turn off indentation stripping?



On Apr 11, 2017, at 11:08 AM, Adrian Zubarev via swift-evolution 
<[email protected]> wrote:

This would be consistent and less confusing to learn.

Can’t we make the indent algorithm work like this instead?
let string = """\↵
····<tag>↵
······content text↵
····</tag>""" // Indent starts with the first non space character

// result

<tag>↵
··content text↵
</tag>
The line where the closing delimiter is trims all space chapters and the indent 
for the whole multi-line string is starting at the point where the first 
non-space chapters is in that line.

What do you think?

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to