Git Product home page Git Product logo

Comments (3)

davidsu avatar davidsu commented on May 17, 2024

I've made a pull request for this #78

from vim-prettier.

mitermayer avatar mitermayer commented on May 17, 2024

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

  • :PrettierPartial - is the intended behaviour of #78 and #75 (sends the whole buffer to prettier and uses --range-start and --range-end to control formatting, it can fail if the file has errors even if outside the supplied range)
  • :PrettierFragment - is the previous default behaviour where we only send selected portion to prettier (it has some benefits in that we only send less buffer and allow for formatting sections of files that are not entirely valid as a whole and have errors)

from vim-prettier.

mitermayer avatar mitermayer commented on May 17, 2024

cc @docwhat,

from vim-prettier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.