mirror of
https://github.com/microsoft/vscode.git
synced 2026-03-02 06:35:29 +00:00
[html] editor.action.formatDocument removes <script> property. Fixes #36574
This commit is contained in:
@@ -253,7 +253,7 @@ export function getJavascriptMode(documentRegions: LanguageModelCache<HTMLDocume
|
||||
let start = currentTextDocument.offsetAt(range.start);
|
||||
let end = currentTextDocument.offsetAt(range.end);
|
||||
let lastLineRange = null;
|
||||
if (range.end.character === 0 || isWhitespaceOnly(currentTextDocument.getText().substr(end - range.end.character, range.end.character))) {
|
||||
if (range.end.line > range.start.line && (range.end.character === 0 || isWhitespaceOnly(currentTextDocument.getText().substr(end - range.end.character, range.end.character)))) {
|
||||
end -= range.end.character;
|
||||
lastLineRange = Range.create(Position.create(range.end.line, 0), range.end);
|
||||
}
|
||||
|
||||
@@ -107,6 +107,10 @@ suite('HTML Embedded Formatting', () => {
|
||||
assertFormat('<html><head>\n |<script>\nvar x=6;\n</script>\n|</head></html>', '<html><head>\n <script>\n var x = 6;\n </script>\n</head></html>');
|
||||
});
|
||||
|
||||
test('bug 36574', function (): any {
|
||||
assertFormat('<script src="/js/main.js"> </script>', '<script src="/js/main.js"> </script>');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function applyEdits(document: TextDocument, edits: TextEdit[]): string {
|
||||
|
||||
Reference in New Issue
Block a user