When using prettier ver3 with coc-prettier, an error seems to be output when starting the extension. It seems that coc-prettier needs to be adjusted for prettier ver3.
Error
Screen shot:
CocInfo:
...snip
2023-07-06T16:19:38.820 INFO (pid:2849) [services] - LanguageClient ESLint state change: stopped => starting
2023-07-06T16:19:38.822 ERROR (pid:2849) [server] - unhandledRejection Promise {
<rejected> TypeError: Cannot read properties of undefined (reading 'forEach')
at PrettierEditService.getSelectors (/Users/yaegassy/.config/coc/extensions/node_modules/coc-prettier/lib/index.js:4439:18)
at PrettierEditService.handleActiveTextEditorChanged (/Users/yaegassy/.config/coc/extensions/node_modules/coc-prettier/lib/index.js:4411:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
} TypeError: Cannot read properties of undefined (reading 'forEach')
at PrettierEditService.getSelectors (/Users/yaegassy/.config/coc/extensions/node_modules/coc-prettier/lib/index.js:4439:18)
at PrettierEditService.handleActiveTextEditorChanged (/Users/yaegassy/.config/coc/extensions/node_modules/coc-prettier/lib/index.js:4411:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
...snip
Repro
mkdir -p $HOME/check-prettier3
cd $HOME/check-prettier3
npm init -y
npm i prettier@^3.0.0
nvim check.ts
Description
version 3 of prettier has been released.
When using prettier ver3 with coc-prettier, an error seems to be output when starting the extension. It seems that coc-prettier needs to be adjusted for prettier ver3.
Error
Screen shot:
CocInfo:
Repro