Open cmcaine opened 6 years ago
@cmcaine Can I please check what you mean by prettier handles it correctly?
I am guessing you mean, when you run prettier on the whole file, and not just the range?
You can now reproduce ranges issues using the prettier playground.
E.g. Here is a range I am selecting from a separate, unrelated issue: https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBLAtgBwgJxgAgBtUAjfAMxwnXwB0RiT6BuWqNjqSKAZwIEN8AXnxkhAPnzceEQnAB0hCAHMAFCQCUrdjs6N5M9HBgALVFDVaQAGhARMMVNB7JQ-HFQDuABXcIXKPwAbhCoACY2ICQ4-GAA1sYAypix5srIMDgArnC25jxweN4xyuj8yOT8hAW2AFY8AB4AQjHxSfxGADLmcBVVNSApOAU4yFH8JACeSlCRmDjmMADq4abIABwADLbzEAVLMZhj83AjQb22OHAAjlmoV8X8peVIldW5IAXoqBnZHzxpOQARSyEHgfXethgExWYTWSAATFCYqhiBYAMLUMpjKDQC4gLIFAAqEwCbwGMQscES0LwyARSJAlOUcAAolAIkgAGybAC+vKAA
My guess is you will be able to reproduce the issue there if you apply the same range to your source that matches your git diff (i.e. what precise-commits is doing for you behind the scenes)
Please could you try and build that reproduction in the playground to confirm?
Yes, I am comparing with running the whole file through prettier.
This issue should maybe be on prettier rather than here. Depends what prettier --range-*
is intended to do. Obviously in the precise-commits use this is wrong. Maybe if you just want to format some js in another document --range is fine, though what it's doing here is still pretty weird.
Prettier handles it correctly.