-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Related with #102, it seems that depending on the code structure coc-prettier will partially remove file contents instead of formatting whenever folding is enabled.
The file being test against is the following, however I had the same sort of behaviour with different structures, where the content is partially/fully stripped:
module.exports = function () {
return;
};Please bear in mind this happens only with syntax folding enabled on load and running :CocCommand prettier.formatFile or through coc.preferences.formatOnSaveFiletypes
I have been able to reproduce this under a clean installation under a container with the following image:
FROM node:alpine
WORKDIR /root
RUN apk add vim git
# install coc.vim
RUN mkdir -p ~/.vim/pack/coc/start
RUN cd ~/.vim/pack/coc/start && git clone --depth 1 https://github.com/neoclide/coc.nvim.git
# define ~/.vimrc
RUN echo "set background=dark" >> ~/.vimrc
RUN echo "set foldmethod=syntax" >> ~/.vimrc
RUN echo "set foldlevelstart=0" >> ~/.vimrc
RUN echo "let javaScript_fold=1" >> ~/.vimrc
# prepare coc-prettier auto-install
RUN echo "let g:coc_global_extensions = [ 'coc-prettier' ]" >> ~/.vimrc
# add test file
RUN printf 'module.exports = function(){\n\nreturn;\n};\n' > ~/test.js
To reproduce:
docker build . -t vim-coc-testdocker -it --rm vim-coc-test vim test.js- wait
coc-prettierinstallation and press q once done - with test.js open and folding closed, run vim command
:CocCommand prettier.formatFile - press any key and you will see content has been removed
leland-kwong
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested