[html] Sytax Highlighting is way off with new line after event handler (#162319)

This commit is contained in:
Martin Aeschlimann
2022-09-29 12:19:36 +02:00
committed by GitHub
parent c4359c2dab
commit 320f338681
2 changed files with 3 additions and 3 deletions

View File

@@ -196,9 +196,9 @@ function getSuffix(c: EmbeddedRegion) {
}
function substituteWithWhitespace(result: string, start: number, end: number, oldContent: string, before: string, after: string) {
let accumulatedWS = 0;
result += before;
for (let i = start + before.length; i < end; i++) {
let accumulatedWS = -before.length; // start with a negative value to account for the before string
for (let i = start; i < end; i++) {
const ch = oldContent[i];
if (ch === '\n' || ch === '\r') {
// only write new lines, skip the whitespace

View File

@@ -122,7 +122,7 @@ suite('HTML Embedded Support', () => {
assertEmbeddedLanguageContent('<div onKeyUp="foo()" onkeydown="bar()"/>', 'javascript', ' foo(); bar(); ');
assertEmbeddedLanguageContent('<div onKeyUp="return"/>', 'javascript', ' return; ');
assertEmbeddedLanguageContent('<div onKeyUp=return\n/><script>foo();</script>', 'javascript', ' return;\n foo(); ');
});
});