mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
[html] Sytax Highlighting is way off with new line after event handler (#162319)
This commit is contained in:
committed by
GitHub
parent
c4359c2dab
commit
320f338681
@@ -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
|
||||
|
||||
@@ -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(); ');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user