prettier / vim-prettier

A Vim plugin for Prettier
MIT License
1.78k stars 138 forks source link

1.0.0-alpha: error upon save file: Error detected while processing function... #230

Open city41 opened 4 years ago

city41 commented 4 years ago

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

What is the current/expected behavior? Upon saving a file, expecting it to format the code. But instead getting

Error detected while processing function prettier#Prettier[33]..prettier#job#runner#run[2]..<SNR>86_asyncFormat[14]..prettier#job#async#ne
ovim#run:
line   23:

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) ? /home/matt/dev/jumpclub/node_modules/.bin/prettier

(ie, the local prettier inside my project)

Did this work in previous versions of vim-prettier and/or prettier ?

I think so. I am setting up a new machine and I believe when I installed my vim plugins it picked up a newer version of vim-prettier. But I am not totally sure.

Other info vim version: NVIM v0.4.0-1655-gc190415dc OS: Ubuntu 18.04

I installed the 0.x release and do not get the error. The 0.x version seems to be behaving as expected.

and btw, thanks for making this plugin, super useful!

mitermayer commented 4 years ago

Thank you for reporting this! Will try checking with this new release of NVIM as it may be an incompatibility. Will aim to send a fix in the next couple days If i can repro it locally

mitermayer commented 4 years ago

Hi @city41,

I have just submitted some fixes for Neovim on https://github.com/prettier/vim-prettier/commit/f10100e0b48effa9a20052ea9fc634b521c0072d,

Do you mind trying to see if you still have the same issues ?

mitermayer commented 4 years ago

This issue has been fixed

city41 commented 4 years ago

I think I still have the problem. When I save a file I get

Error detected while processing function prettier#Prettier[33]..prettier#job#runner#run[2]..<SNR>85_asyncFormat[14]..prettier#job#async#ne ovim#run:

I went into my plugged directory and confirmed I have the latest vim-prettier. I did that by looking at the file autoload/prettier/job/async/neovim.vim and confirming it has the added redraw! on line 63.

mitermayer commented 4 years ago

Hi @city41

Will reopen this issue and look into it again

marcelarie commented 3 years ago

I have the same problem here.

johnpangalos commented 3 years ago

I have this problem as well though my work around is this:

autocmd BufWritePre *.md,*.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.vue,*.yaml,*.html silent! PrettierAsync

Not the nicest thing, but it stops this error.

sahilrajput03 commented 2 years ago

FYI: I also encountered same problem but I noticed that this happens only if you have

set shell=/bin/bash\ -i
" This usually helps in allowing usage of aliases and funcions from .bashrc file.

in your ~/nvim/init.vim (~/.vimrc) file.

By removing that the issue got resolved!