-
-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Format Changed Lines" command #630
Comments
Some quick pointers: Prettier's range formatterCurrently prettier as a range formatter which is far from prefect and works only on some languages. It formats the first common parent of your range which is a valid ExamplemyFn({
opt1: "val",
opt2: "val2",
}) Now adds Multiple rangesPrettier supports only 1 range per format call. Having multiple (one for each change) should be faster (1 parse) Prettier VSCodeWe should have a way to obtain changed ranges. This is maybe already possible. We shouldn't have to include a dependency on every SCM out there. This would allow us -- with the help of first point -- to format changed lines VSCodeWe may do it as a specific action Linter integrationThey do not support giving them a range. #137 |
FWIW, there's an extension that does something like this: https://github.com/Gruntfuggly/format-modified but it looks like it's using clang-format instead of prettier; perhaps that can help with adding this functionality to Prettier VSCode |
Any updates on this? |
VS Code doesn't support this natively. We would only add this if VS Code's edit providers add this type of API. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When I use "Format on Save", it formats the entire document. This introduces changes on lines I have not touched, making code review much more difficult.
I would like to have the option to check only changed lines, as measured by the active SCM plugin. This would prevent formatting changes from concealing the actual work done in a pull request, while still ensuring that the code I have modified is "Prettier".
I'd be willing to take a shot at this. Please let me know if this would be better handled in the Prettier project or the VS Code project.
The text was updated successfully, but these errors were encountered: