coc-prisma icon indicating copy to clipboard operation
coc-prisma copied to clipboard

Formatting doesn't work for me

Open npearson72 opened this issue 4 years ago • 5 comments

I've followed the instructions here:

https://github.com/pantharshit00/coc-prisma/blob/fc64aaa7fb0f0cdf51a84eeadee53e99fe1d3b90/README.md#formatting

However, when using the command :Format I get the following: E492: Not an editor command: Format

Also, here is what I have in my coc-settings:

...
  "coc.preferences.formatOnSaveFiletypes": [
    "css",
    "html",
    "javascript",
    "javascriptreact",
    "json",
    "jsonc",
    "markdown",
    "prisma",
    "ruby",
    "scss",
    "typescript",
    "typescriptreact",
    "yaml"
  ],
...

But it does not work for prisma. All other filetypes do format properly.

Any ideas?

npearson72 avatar Jan 22 '22 13:01 npearson72

@npearson72 I actually just ran into this--fun that we did this a few days in a row. :Format is from here https://github.com/neoclide/coc.nvim#example-vim-configuration -- you need to add this to your vimrc:

" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')

I actually had to essentially do this to get it to work on save though (prob want to limit the file types, but here we go):

autocmd BufWritePost * call CocActionAsync('format')

lukevers avatar Jan 26 '22 17:01 lukevers

@lukevers thanks, that helps.

Still not sure why it doesn't work with coc.preferences.formatOnSaveFiletypes

npearson72 avatar Jan 26 '22 18:01 npearson72

Yeah I'm not sure either..it almost looks like that's defined from the prettier plugin and not COC directly? I tried the prettier plugin, but it doesn't support prisma lol

lukevers avatar Jan 26 '22 18:01 lukevers

Thanks @lukevers that works great. Any ideas how to get it to work with syntax highlighting? I normally use coc-prettier. The gif in the readme has highlighting, so someone got it to work..

SOLID-arity avatar Feb 24 '22 05:02 SOLID-arity

@SOLID-arity Yeah I'm using https://github.com/pantharshit00/vim-prisma

Here's my vimrc if it helps https://github.com/lukevers/vimrc/blob/main/vimrc#L17

lukevers avatar Feb 24 '22 12:02 lukevers