vscode-yaml-sort
vscode-yaml-sort copied to clipboard
Comment processor messes up yml indentation
Running the plugin with the comment processor enabled seems to mess up the indentation of the yml keys. This seems to happen regardless of the indentation of the comment itself or the sort mode (I tried both "Custom Sort 1" and the generic "Sort YAML"). Indent is set to 2 (which should match the one in the test yml file). I also tried deactivating other processors or other plugins that may mess with this one, did not seem to make a difference. VS Code version is 1.79.2
Example input 1
# Spring boot configuration
server:
# Port to be used by the server
port: 8080
servlet:
# Context path of the application
context-path: /mws
# The server should support graceful shutdown, allowing active requests time to complete.
shutdown: graceful
Example output 1
# Spring boot configuration
server:
# Port to be used by the server
port: 8080
servlet:
# Context path of the application
context-path: /mws
# The server should support graceful shutdown, allowing active requests time to complete.
shutdown: graceful
Example input 2 - adjusting comments to indent of the keys
# Spring boot configuration
server:
# Port to be used by the server
port: 8080
servlet:
# Context path of the application
context-path: /mws
# The server should support graceful shutdown, allowing active requests time to complete.
shutdown: graceful
Example output 2
# Spring boot configuration
server:
# Port to be used by the server
port: 8080
servlet:
# Context path of the application
context-path: /mws
# The server should support graceful shutdown, allowing active requests time to complete.
shutdown: graceful
Hello @stefan-hinterberger, I fixed a lot of bugs in the last weeks. In the latest version (6.5.9) I cannot confirm your issue. I assume it is solved in the meanwhile. If not, feel free to open this issue again.
Hello, I tried the versions 6.5.9 and 6.5.10 (latest) on the provided example above because I'm facing the same issue and I can confirm the problem is still present.
@J-PC can you provide a code example and your settings?
I faced the same issue with version v6.5.14
, without any change to the default configuration.
For the reproduction.
Starting from:
# Environment for the openshift deployment
el:
api:
org-api-keys:
1: 'toto'
eq:
# deployments:
# dashboard:
# enabled: true
# api:
# url: tata
# key: tutu
# data:
# environment: INT
# manifest-file: file:/data/workdir/manifest.json
auth:
org-sso-ids:
1: 'pwet'
org-organization-uuids:
1: 'pwet'
management:
modules:
cp:
enabled: true
relationship: true
workflows-enabled: false
allow:
enabled: false
Using the sort yaml
, we end up with (auth is now a first level key):
---
el:
api:
org-api-keys:
'1': toto
eq:
# deployments:
# dashboard:
# enabled: true
# api:
# url: tata
# key: tutu
# data:
# environment: INT
# manifest-file: file:/data/workdir/manifest.json
auth:
org-sso-ids:
'1': pwet
org-organization-uuids:
'1': pwet
management:
modules:
cp:
enabled: true
relationship: true
workflows-enabled: false
allow:
enabled: false# Environment for the openshift deployment
The expected yaml would be:
---
# Environment for the openshift deployment
allow:
enabled: false
el:
api:
org-api-keys:
'1': toto
eq:
# deployments:
# dashboard:
# enabled: true
# api:
# url: tata
# key: tutu
# data:
# environment: INT
# manifest-file: file:/data/workdir/manifest.json
auth:
org-organization-uuids:
'1': pwet
org-sso-ids:
'1': pwet
management:
modules:
cp:
enabled: true
relationship: true
workflows-enabled: false