Do you want to request a feature or report a bug?
Bug
What is the current/expected behavior?
Running PrettierAsync moves cursor to the top of the buffer when prettier ends up changing the amount of lines in the document (e.g by removing a newline in an empty object). The synchronous Prettier command doesn't do this.
e.g
const foo = () => {
}
:PrettierAsync
Content will (as expected) change to
const foo = () => {}
but the cursor will be moved to the top of the buffer
What version of vim-prettier are you using - (output of :PrettierVersion) ?
1.0.0-alpha
What version of prettier are you using - (output of :PrettierCliVersion) ?
1.19.1
What is your prettier executable path - (output of :PrettierCliPath) ?
~/Documents/project/node_modules/.bin/prettier
Did this work in previous versions of vim-prettier and/or prettier ?
Yes, this issue appeared when upgrading vim-prettier, in the same project with the same version of prettier.
Hi There,
In order for me to more reliably attempt to replicate this issue and submit a fix for it, could you please provide the output of your
vim --version ?
Thanks a lot!
I'm using Neovim 0.4.3. I just tried it out in Vim 8.1 and the same bug doesn't appear so this seems to be a Neovim-specific issue
I'm facing the same issue:
位 nvim --version
NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/build/config -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/src -I/usr/local/include -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/deps-build/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/build/src/nvim/auto -I/tmp/neovim-20191107-13403-1or2rj3/neovim-0.4.3/build/include
Compiled by [email protected]
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.3/share/nvim"
Run :checkhealth for more info
I'm on the latest version of this plugin.
This seems to be nvim 0.4.x issue with vim-prettier I will submit a PR to fix this soon
Sorry with the crazyness of moving countries and starting new job I did not had time to look into this before.
will look into this today and submit a fix for it hopefully soon
Working on this now. will comment in this issue with any findings and will try to submit a fix for it in the next few hours
Was able to reproduce this issue on neovim 0.4.3
Just opened a PR fixing this issue https://github.com/prettier/vim-prettier/pull/231
Most helpful comment
Just opened a PR fixing this issue https://github.com/prettier/vim-prettier/pull/231