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

PrettierAsync moves cursor to top of buffer #229

Closed
sleeplesslord opened this issue Feb 27, 2020 · 8 comments · Fixed by #231
Closed

PrettierAsync moves cursor to top of buffer #229

sleeplesslord opened this issue Feb 27, 2020 · 8 comments · Fixed by #231

Comments

@sleeplesslord
Copy link

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.

@mitermayer
Copy link
Member

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!

@sleeplesslord
Copy link
Author

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

@umayr
Copy link

umayr commented Mar 3, 2020

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.

@mitermayer
Copy link
Member

This seems to be nvim 0.4.x issue with vim-prettier I will submit a PR to fix this soon

@mitermayer
Copy link
Member

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

@mitermayer
Copy link
Member

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

@mitermayer
Copy link
Member

Was able to reproduce this issue on neovim 0.4.3

@mitermayer
Copy link
Member

Just opened a PR fixing this issue #231

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

Successfully merging a pull request may close this issue.

3 participants