简体   繁体   中英

Coc-Prettier not picking up project or home config

I'm using neovim with the coc-prettier plugin extension. The formatting is working as expected, but I can't seem to get it to pick up the settings from config files. I'm wondering if there is another step I'm missing. I looked at the README on the extension's repo and it doesn't mention anymore setup and says the config file should overload the defaults. I currently don't have anything set in the Coc config.

This is my neovim config file:

set autoindent
set nobackup
set history=50
set ruler
set showcmd
set incsearch
syntax on
set hlsearch
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set expandtab
set number
set hidden
set updatetime=100
set omnifunc=syntaxcomplete#Complete

map q <Nop>
map <C-o> :NERDTreeToggle<CR>

xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)

if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
    silent !curl -fLo 
    \ ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

call plug#begin()
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'pangloss/vim-javascript'
Plug 'preservim/nerdtree'
call plug#end()

let g:coc_global_extension = [
                \'coc-eslint',
                \'coc-json',
                \'coc-pairs',
                \'coc-prettier'
\]

"let g:prettier#config#config_precedence = 'file-override'
command! -nargs=0 Prettier :CocCommand prettier.formatFile
xmap <leader>p :Prettier<CR>
nmap <leader>p :Prettier<CR>

let NERDTreeShowHidden = 1

coc-prettier将遵循 Prettier 的配置设置https://prettier.io/docs/en/configuration.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM