Do you want to request a feature or report a bug?
Bug
What is the current/expected behavior?
Vim-prettier is not using project's config. This is my config:
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: false,
trailingComma: "all",
bracketSpacing: true,
};
And when I type :Prettier it formats my code from:
import { x } from "x"; to import {x} from 'x';
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.14.3^@
What is your prettier executable path - (output of :PrettierCliPath) ?
/Volumes/D\ 2/projects/foo/node_modules/.bin/prettier
Did this work in previous versions of vim-prettier and/or prettier ?
Dunno, I'm using it first time
Maybe I skiped some instalation step? I'm using Vundle as plugin manager, I've added line Plugin 'prettier/vim-prettier' and typed yarn install at .vim/bundle/vim-prettier.
Hi @szymkab
Can you please provide a bit more context on this issue ?
Thanks a lot!
prettier.config.jsProject Root/
โ
โโโ source/
โ โโโ bar/
โ โโโ foo.js
โโโ prettier.config.js
Will try to reproduce this issue and keep you posted. Do you have any custom vim-prettier configuration on your .vimrc ?
Nope, I don't have
I have the same issue.
Since 2 people are confirming this issue I will try to replicate this again
not respecting my package.json, or .prettierrc either. Updated to latest master as of today.
@ryanflorence thanks for checking, I will try to find some time to fix this ASAP. It looks like a regression caused by some incompatibilities with latest prettier bin releases.
I will try to investigate this ASAP, in the meantime I am also open for PR's
In the meantime can you all test adding this to your vimrc ?
let g:prettier#config#config_precedence = 'file-override'
I will investigate this issue as soon as I can get some free time
I would like to investigate prettier cli itself. It sounds like a regression. Note that https://prettier.io/docs/en/cli.html#config-precedence
prefer-file
If a config file is found will evaluate it and ignore other CLI options. If no config file is found CLI options will evaluate as normal.
This option adds support to editor integrations where users define their default configuration but want to respect project specific configuration.
Can you folks try again on release/1.x ?
To test this on the release/1.x branch do on your .vimrc
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'branch': 'release/1.x',
\ 'for': [
\ 'javascript',
\ 'typescript',
\ 'css',
\ 'less',
\ 'scss',
\ 'json',
\ 'graphql',
\ 'markdown',
\ 'vue',
\ 'lua',
\ 'php',
\ 'python',
\ 'ruby',
\ 'html',
\ 'swift' ] }
Unfortunately, I'm seeing the same behavior. Unless I have something configured incorrectly.
@esparkman any chance you could create a small repro ? I would love to fix this ASAP or at least find out what is happening.
@mitermayer for sure I'll let you know here when it's pushed up.
@mitermayer https://github.com/esparkman/vue-admin-dashboard
Will look into it soon and comment in here the findings and follow up steps. Thanks a lot for that
@esparkman some questions that may aid on my investigations:
thanks a lot!
I open from the Projects root directory
vue-admin-dashboard on ๎ master via โฌข v10.15.0
โข3% โ vim .
From within the Project I've been testing in src/components/Header.vue
I don't have Lint on Save enabled. So I am manually running :Prettier when I want to lint.
Should now be fixed on release/1.x branch https://github.com/prettier/vim-prettier/pull/160
Pleas make sure to update prettier deps to latest when testing
Cc @shuLhan
Could you test this case to see if your PR fixed this issue ? (Please if possible check with the latest prettier CLI install dep)
@mitermayer it seems to work fine for me with the release/1.x branch.
@mitermayer I can't reproduce this issue.
@szymkab are you sure there are no other plugins that may interfere with formatting? Just to make sure, create a new .vimrc, clear all bundles, and retry it again.
Closing this as this is working on release/1.x and I will promoting that version soon
I seem to be having this issue too, and I'm using the release you mentioned earlier, even though it should be there by default already. Still, it doesn't take my config file into account. I'm using a .prettierrc file.
@marcmarina please use master that release has been already merged to master
Most helpful comment
I have the same issue.