Skip to content

Commit d11c3c5

Browse files
authored
Don't append extra trailing newlines when saving server-side web app files (#1648)
1 parent c61b6b9 commit d11c3c5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/providers/FileSystemProvider/FileSystemProvider.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,15 @@ export class FileSystemProvider implements vscode.FileSystemProvider {
489489
content: base64EncodeContent(contentBuffer),
490490
enc: true,
491491
};
492+
if (
493+
csp &&
494+
!putContent.enc &&
495+
putContent.content.length > 1 &&
496+
putContent.content[putContent.content.length - 1] == ""
497+
) {
498+
// Avoid appending a blank line on every save, which would cause a web app file to grow each time
499+
putContent.content.pop();
500+
}
492501
// By the time we get here VS Code's built-in conflict resolution mechanism will already have interacted with the user.
493502
// Therefore, it's safe to ignore any conflicts.
494503
return api

0 commit comments

Comments
 (0)