Application Composer updates template.yaml just by opening it (plus removing trailing empty line)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
## Problem
Application Composer reformats the file just by opening it. And the reformatting removes the last empty line.
## Steps to reproduce the issue
When I have specified a schema in my template.yaml file like
```
# schema: https://raw.githubusercontent.com/aws/serverless-application-model/main/samtranslator/schema/schema.json
AWSTemplateFormatVersion: 2010-09-09
```
I get

and when I click that, the 'template.yaml (Application Composer)' window appears.
As part of the loading of the window, the document is reformatted.
As such the formatting is not a huge problem, but surprising. However, the removal of the empty line at the end is a problem as [super-linter](https://github.com/super-linter/super-linter) wants YML to end with an empty line.
## Expected behavior
A "visualize" command should not update the file. Let "format document" handle that.
And do not remove the last empty line as that gives YAML lint errors from super-linter -

## System details (run `AWS: About` and/or `Amazon Q: About`)
VS Code About:
Version: 1.91.0 (user setup)
Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286
Date: 2024-07-01T18:52:22.949Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Windows_NT x64 10.0.22631
- OS: Windows 11
- Visual Studio Code version: 1.91.0
- AWS Toolkit version: 3.12.0
- Amazon Q version: n/a
Contributor guide
Research direction
Reproduce the issue by opening the Application Composer view for a template.yaml containing the shown schema comment and trailing empty line. Start by tracing the Application Composer visualize/open flow and compare the document before and after loading. Done means visualization leaves the file unchanged, preserves the final empty line, and formatting remains available through Format Document.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100