Closed elpete closed 4 years ago
I have thought about this in the past - I do think it is doable, but I am not sure if it will be consistent with people's expectations? So, as you suggest, another setting is probably needed. I would think it would need to go both ways so maybe something like strings.avoidEscapes
?
Supposing you started with:
var someStringWithQuotesInside = """";
Would you want.expect that formatted to be formatted to (even with the quote setting being double
)
var someStringWithQuotesInside = '"';
or just avoid the conversion when starting with '"'
?
I think I’d leave alone any quotes with quotes inside in each direction.
I have added a setting "strings.convertNestedQuotes": true
(open to better naming ideas). You can set this to false
to avoid the quote conversion when the string contains quotes.
This one might not be possible and may need the ignore pragmas, but consider this use case:
If I format this with
"strings.quote":"double"
then I get this output:Not as readable, in my opinion.
It would be awesome if the setting was something like
preferDouble
so it would not escape if it didn't have to.I realize this can get confusing with multiple levels of quotes, and I understand if you would suggest to just use the pragma to ignore these uncommon situations.