pantharshit00 / coc-prisma

CoC extension that implements the Prisma language server
MIT License
76 stars 7 forks source link

Formatting doesn't work for me #22

Open npearson72 opened 2 years ago

npearson72 commented 2 years ago

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?

lukevers commented 2 years ago

@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')
npearson72 commented 2 years ago

@lukevers thanks, that helps.

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

lukevers commented 2 years ago

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

SOLID-arity commented 2 years ago

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..

lukevers commented 2 years ago

@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