Comments (3)
I've made a pull request for this #78
from vim-prettier.
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.
cc @docwhat,
from vim-prettier.
Related Issues (20)
- feature request to disable automatic mappings set by the plugin
- .eslintrc is ignored
- prettier hang on formatting a bigger file
- MacOS Monterey M1 plugin not loaded
- When endOfLine option set to 'crlf', ^M appear at the end of each line
- Prettier: failed to parse buffer — on mixed HTML/PHP file HOT 1
- Formatting on save stop when saving again
- Deletes comments in Ruby files HOT 3
- The same prettier doesn't work correctly on WSL
- plugin didn't work without installing eslint-config-prettier & eslint-plugin-prettier
- Request: check for filetype javascript (not just the .js and .jsx extensions) HOT 1
- Prettier auto format on Save not working. HOT 1
- Why prettier keeps adding warn messages on top of my document? HOT 16
- Deprecated / Unknown options when using Prettier v3 HOT 3
- Keep show warning after save! HOT 1
- Error while resolving package dependencies HOT 3
- Error on manual trigger
- prettier runs with incorrect prettier configuration HOT 2
- Vim-Prettier is using its own defaults, not the defaults from prettier (in my case, trailingComma)
- `Failed to parse buffers` for Ruby files. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-prettier.