aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.47k stars 408 forks source link

Application Composer updates template.yaml just by opening it (plus removing trailing empty line) #5272

Open per-oestergaard opened 2 months ago

per-oestergaard commented 2 months ago

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 image

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 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 - image

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