Skip to content
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

Formatting with visual selection doesn't respect indentation #75

Closed
davidsu opened this issue Nov 6, 2017 · 3 comments
Closed

Formatting with visual selection doesn't respect indentation #75

davidsu opened this issue Nov 6, 2017 · 3 comments

Comments

@davidsu
Copy link

davidsu commented Nov 6, 2017

It formats nicely but removes indentation from first line of visual selection.
I suppose it would be more reasonable to just keep the current indentation

@davidsu
Copy link
Author

davidsu commented Nov 8, 2017

I've made a pull request for this #78

@mitermayer mitermayer added enhancement and removed bug labels Nov 8, 2017
@mitermayer
Copy link
Member

Fix this on branch 1.x (ec6ede9)


Important notes:
Using the prettier api for --range-start and --range-end had some downsides:

  • sending larger buffer to prettier
  • requires the whole file to be valid even when formatting just portion of the file.

Details:
I kept the old behaviour as the default, but made it configurable via a flag, so users can make partial formatting enabled for them if they wish by simply:

let g:prettier#partial_format=1

I also created 2 helper commands :PrettierPartial and :PrettierFragment

@mitermayer
Copy link
Member

cc @docwhat,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants