Fixed formatting on script blocks#18806
Conversation
| // if child is a list item - try to get its indentation, only if parent is within the original range. | ||
| let childIndentationAmount = Constants.Unknown; | ||
| if (isListItem) { | ||
| if (isListItem && parent.pos >= originalRange.pos && parent.end <= originalRange.end) { |
There was a problem hiding this comment.
We've got a rangeContainsRange helper function
| format.selection("begin4", "end4"); | ||
| format.selection("begin5", "end5"); | ||
|
|
||
| verify.currentFileContentIs("/* BEGIN EXTERNAL SOURCE */\n\n var a = 1;\n alert(\"/********/\");\n\n/* END EXTERNAL SOURCE */\n\n/* BEGIN EXTERNAL SOURCE */\n\n var b = 1;\n\n var c = \"/********/\";\n var d = 1;\n\n var e = \"/********/\";\n var f = 1;\n\n/* END EXTERNAL SOURCE */"); |
There was a problem hiding this comment.
Ooof. That's pretty ugly to have one long line with all the newline literals. It's hard to see what is going on. Using a multi-line string is dangerous as Git may checkout with different line endings, but could at least use line continuations to continue the string, e.g. something like:
verify.currentFileContentIs("\
/* BEGIN EXTERNAL SOURCE */\n\n\
var a = 1;\n\
alert(\"/********/\");\n\n\
/* END EXTERNAL SOURCE */\n\n\
/* BEGIN EXTERNAL SOURCE */\n\n\
var b = 1;\n\n\
var c = \"/********/\";\n\
var d = 1;\n\n\
var e = \"/********/\";\n\
var f = 1;\n\n\
/* END EXTERNAL SOURCE */");There was a problem hiding this comment.
git config core.autocrlf false will cause git to use whatever is actually in the repo, all the time. input or false should probably be required for our repo, since we do actually have some tests which are newline-sensitive (though most get around newline coercion by having mixed newlines...), and newline coercion is unneeded with modern editors and tooling. So a backtick-literal here would be super nice.
Fixed formatting on script blocks, added regression tests, fixed minor bugs.