Skip to content

No way to insert into YAML without matching indent of previous line #1750

@snydergd

Description

@snydergd

Describe the bug
Inserting/pasting at the end of a YAML document nests/indents the YAML in an unwated way.

In previous versions of Eclipse STS (3.9 and before), I could cut/copy a section of YAML from one document to the other and it would keep the indentation, but in this version it always appears to match the indentation of last non-empty line preceding the target line for paste. This is not at all helpful, because I would never want to nest my properties farther down than they were in the source document, and it means I always need to adjust the indent after pasting, or else insert a dummy character at the desired indent level before pasting (that I then delete after pasting).

It's possible this should be submitted to another repository, but I don't understand Eclipse well enough to know what piece is causing the issue. If it is actually caused by a switch from one component to another, it might be a feature request vs. a bug, but I don't know if it is or not. At a minimum it would be great to have an option to disable this behavior, even though I don't understand why it would ever be desirable.

To Reproduce
Open an application.yml file in a Spring project using STS for Eclipse 5.0.0.RELEASE (also attempted in 4.30), and populate it with two YAML documents - a sample is below.

Try moving top-level properties/section (e.g., logging in the sample) from one document to the bottom of the other document. When pasted, you will see that the properties are now nested beneath the last property in the target document (in the sample, logging becomes nested beneath spring.activemq.pool).

Sample

spring:
  debug: false
  activemq:
    pool:
      idle-timeout: 2000

---
my-property: hello
logging:
  level:
    root: warn

What I've tried
I've tried making several changes to settings - applying and restarting STS between each.

  • Uncheck all language servers in "Language Servers"
  • Uncheck "YAML (Wild Web Developer)" -> "Format" -> "Enable/disable default YAML formatter"
  • Uncheck "Java" -> "Editor" -> "Typing" -> "When pasting" -> "Adjust indentation"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions