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

Bug: Bracket spacing is ignored #222

Closed
schontz opened this issue Dec 26, 2019 · 2 comments
Closed

Bug: Bracket spacing is ignored #222

schontz opened this issue Dec 26, 2019 · 2 comments

Comments

@schontz
Copy link

schontz commented Dec 26, 2019

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

What is the current/expected behavior?
By default, bracket spacing is true, thus I expect the following format:

import { foo } from './foo.js';

But vim-prettier is always collapsing that to:

import {foo} from './foo.js';

What version of vim-prettier are you using - (output of :PrettierVersion) ?
0.2.7

What version of prettier are you using - (output of :PrettierCliVersion) ?
1.19.1

What is your prettier executable path - (output of :PrettierCliPath) ?
prettier

Did this work in previous versions of vim-prettier and/or prettier ?
This is my first time using vim-prettier. Prettier is working as expected in other editors (VS Code).

@schontz
Copy link
Author

schontz commented Dec 26, 2019

When I save the file in nvim, it collapses the brackets. If I then check the file:

prettier --check "foo.js"
Checking formatting...
foo.js
Code style issues found in the above file(s). Forgot to run Prettier?

...then manually running prettier --write "foo.js" puts the spaces back in.

For reference, here are all my plugins:

" My Plugins
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-airline/vim-airline'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'sheerun/vim-polyglot'
Plugin 'fatih/molokai'
Plugin 'lifepillar/vim-solarized8'
Plugin 'dracula/vim'
Plugin 'neoclide/coc.nvim'
Plugin 'prettier/vim-prettier'
Plugin 'brooth/far.vim'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'airblade/vim-gitgutter'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree-project-plugin'
Plugin 'ryanoasis/vim-devicons'
Plugin 'vwxyutarooo/nerdtree-devicons-syntax'

And my prettier setting:

" Run prettier before save (async)
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.ts,*.tsx,*.json,*.css,*.scss,*.less,*.graphql PrettierAsync

@schontz
Copy link
Author

schontz commented Dec 26, 2019

It turns out there was an issue with coc and its config to formatOnSaveFiletypes. Removing JS/TS let vim-prettier behave properly. But since I'm using coc I switched to coc-prettier instead. Is one preferred over the other (coc-prettier or vim-prettier)?

@schontz schontz closed this as completed Dec 26, 2019
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

No branches or pull requests

1 participant