vmchale/dhall-vim

StripTrailingWhiteSpace in multiline strings

basile-henry opened this issue · 2 comments

Trailing whitespace can be important in multiline strings when we don't want the indentation of the dhall code to end up in the string.

The following is an example of where we want to keep trailing whitespace (space character written as to make it visible):

let foo =
●●●●●●''
●●●●●●multiline
●●●●●●
●●●●●●string
●●●●●●''
in foo

On save, it becomes:

let foo =
●●●●●●''
●●●●●●multiline

●●●●●●string
●●●●●●''
in foo

Which is not the same dhall string anymore:

"multiline\n\nstring\n" /= "      multiline\n\n      string\n      "

Alright, I've updated it so that it will only automatically trim when

g:dhall_strip_whitespace

is set to 1, e.g.

let g:dhall_strip_whitespace = 1

At the moment, I don't think Vimscript is sophisticated enough to do anything else :)

Great, thanks! 👍