prettier-java icon indicating copy to clipboard operation
prettier-java copied to clipboard

Support for rangeStart/rangeEnd

Open jhaber opened this issue 3 years ago • 1 comments

Prettier-Java 1.2.0

# Options (if any):
--range-start 19
--range-end 98

Input:

package com.test;

public class Test {
  public void sayHello() { System.out.println("hello"); }
}

Output:

package com.test;

public class Test {
  public void sayHello() { System.out.println("hello"); }
}

Expected Output:

package com.test;

public class Test {

  public void sayHello() {
    System.out.println("hello");
  }
}

Expected behavior:

It seems like passing range start/end cause nothing to get formatted, even though the code that should get reformatted is within the specified range. Is this just something that isn't implemented yet?

For some context, I was trying to speed up formatting within our IntelliJ integration by only formatting modified lines (although maybe it won't make a huge difference if we still need to parse the whole file)

jhaber avatar Jun 19 '21 12:06 jhaber

This functionality is indeed not implemented, as I was completely unaware of its existence in Prettier !

clementdessoude avatar Jun 20 '21 13:06 clementdessoude