Registry / devops / coc-prettier

coc-prettier

JSON →
library11.0.1jsnpmunverified

Prettier formatter extension for coc.nvim, version 11.0.1. Fork of prettier-vscode adapted for Neovim/Vim via the coc.nvim async completion framework. Supports formatting for JavaScript, TypeScript, CSS, HTML, Markdown, YAML, and more via Prettier plugins. Uses project-local or global Prettier installation with fallback to bundled version. Configure via coc-settings.json or Prettier config files. Release cadence follows coc.nvim ecosystem. Key differentiator: native integration with coc.nvim's async formatting pipeline vs standalone formatters.

npm install coc-prettier
INSTALL
IMPORT
SIG · COC-PRETTIER
C
coc-prettier
devopsjavascriptv11.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Installs the extension via :CocInstall, then demonstrates formatting the current buffer and setting up format-on-save for common filetypes.

:CocInstall coc-prettier " In your project, after prettier is installed locally: " format current buffer :call CocAction('format') " or use a key mapping nmap <silent> <Leader>f <Plug>(coc-format) " Automatically format on save via coc-settings.json: " { " "coc.preferences.formatOnSaveFiletypes": ["javascript", "typescript", "json", "html", "css", "markdown"] " }
Debug
Known issues
gotchaLocal prettier installation overrides bundled version; ensure prettier is listed in project's devDependencies or root package.json to avoid version mismatch.
fix
Run `npm install prettier -D --save-exact` inside your project and verify it is resolved correctly.
affects: >=0.0.1
gotchaFormat-on-save requires explicit configuration in coc-settings.json; the extension does not enable it by default.
fix
Add `"coc.preferences.formatOnSaveFiletypes": [...]` to your coc-settings.json.
affects: >=0.0.1
gotchaPlugins for additional languages (e.g., Ruby, PHP) must be installed separately and registered in package.json; this extension only activates plugins from a local or global prettier resolution.
fix
Install the desired plugin (e.g., `@prettier/plugin-ruby`) and ensure it appears in your project's package.json.
affects: >=0.0.1
gotchaThe `prettier.resolveGlobalModules` option (default false) if set to true may load global prettier which could mismatch project config or be untrusted; user will be prompted to confirm.
fix
Set `"prettier.resolveGlobalModules": false` (default) and always use local prettier.
affects: >=0.0.1
gotchaSettings defined in coc-settings.json apply only when formatting via the extension, not via CLI; always use Prettier config files for consistent behavior across tools.
fix
Create .prettierrc in your project root and avoid relying on coc-settings.json for non-project files.
affects: >=0.0.1
Errors
Common errors & fixes
CocInstall error: invalid extension
The coc.nvim version is older than 0.0.82 or the extension name is misspelled.
fix
Update coc.nvim via `:CocUpdate` and install with `:CocInstall coc-prettier` (note hyphen).
Prettier module not found
Prettier is not installed locally nor globally, and the bundled version is missing or corrupted.
fix
Run `npm install prettier -D --save-exact` in your project root.
Cannot read property 'format' of undefined
Format action called but no formatter registered for the current filetype.
fix
Ensure prettier supports the filetype, or add a Prettier config. Check `:CocInfo` to see registered formatters.
Upgrade
Version history
11.0.1latest on npm
Audit
Dependencies
coc.nvimrequiredRequired runtime plugin host; coc-prettier is an extension that runs within coc.nvim
prettieroptionalCore formatter engine; bundled but project-local or global installation recommended
Agent activity
4 hits · last 30 days
node
4
Resources
coc-prettier — npm install coc-prettier · libregistry