vim-prettier
vim-prettier copied to clipboard
Bug: Switching pane to terminal pane before Prettier finishes inserts strange characters
Do you want to request a feature or report a bug? bug
What is the current/expected behavior? Current:
- Save buffer
- Move to :term window while prettier is running in the background
- Vim freezes
- press ctrl+c, "Can't parse buffer" error appears.
- Go back to original pane, there are strange characters on top of the file
Expected: vim-prettier can still update the old pane if you move to a term pane before it finishes
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
) ?
2.0.5^@
What is your prettier
executable path - (output of :PrettierCliPath
) ?
prettier
Did this work in previous versions of vim-prettier and/or prettier ? Not sure, I recently switched from tmux to :term. I've been seeing occasionally at work but finally can repro consistently on my rasbperry pi since it's slower and gives me time to switch panes before prettier finishes.
Trying to understand the steps to repro in order to look into this.
Did you save a javascript file than switched to a ".svg" buffer ?
No svg buffer. Here are more detailed repro steps:
- open a javascript file that isn't formatted
- open a terminal buffer split in vim8 with
:term
- switch back to javascript file's split
ctrl+w j
- save javascript file
:w
- move back to term buffer split before prettier async auto save is done
ctrl+w k
- when prettier async finishes there will be an error in the status bar saying prettier failed to parse the js file
- move back to the js file, go to the top of the file and observe strange text
You need a slow device or large enough file so you have time to switch to the terminal buffer before prettier async is done.
screencast of the bug Screen Recording 2020-05-12 at 10.55.34 PM.zip