vim-prettier icon indicating copy to clipboard operation
vim-prettier copied to clipboard

Bug: Switching pane to terminal pane before Prettier finishes inserts strange characters

Open lazopm opened this issue 4 years ago • 2 comments

Do you want to request a feature or report a bug? bug

What is the current/expected behavior? Current:

  1. Save buffer
  2. Move to :term window while prettier is running in the background
  3. Vim freezes
  4. press ctrl+c, "Can't parse buffer" error appears. bug00
  5. Go back to original pane, there are strange characters on top of the file bug0

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.

lazopm avatar Apr 27 '20 00:04 lazopm

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 ?

mitermayer avatar May 13 '20 00:05 mitermayer

No svg buffer. Here are more detailed repro steps:

  1. open a javascript file that isn't formatted
  2. open a terminal buffer split in vim8 with :term
  3. switch back to javascript file's split ctrl+w j
  4. save javascript file :w
  5. move back to term buffer split before prettier async auto save is done ctrl+w k
  6. when prettier async finishes there will be an error in the status bar saying prettier failed to parse the js file
  7. 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

lazopm avatar May 13 '20 06:05 lazopm