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

Formatting doesn't work for me #22

Open
npearson72 opened this issue Jan 22, 2022 · 5 comments
Open

Formatting doesn't work for me #22

npearson72 opened this issue Jan 22, 2022 · 5 comments

Comments

@npearson72
Copy link

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
Copy link

@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
Copy link
Author

@lukevers thanks, that helps.

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

@lukevers
Copy link

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
Copy link

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
Copy link

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

3 participants