`+format/region` crashes lsp server when working with js file
- Dominant language
- Emacs Lisp
- Stars
- 22.7k
- Forks
- 3.1k
- Avg merge
- 10h 46m
- Merged PRs (30d)
- 4
Description
### I confirm that...
- [X] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.
- [X] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.
- [X] The issue can be reproduced on the **latest** available commit of Doom.
- [X] The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. *(Unstable versions end in .50, .60, or .9x)*
### Expected behavior
`+format/region` should behave consistently, either work or fail to work
### Current behavior
`+format/region` failed first time then works after running `+format/buffer` , but crashes `ts-ls` lsp server
### Steps to reproduce
1. open a js file with react component in it.
2. select a region and run `+format/region`
3. it shows `and: Symbol’s function definition is void: apheleia--get-formatters`
4. run `+format/buffer`
5. it works
6. run `+format/region` again
7. it works, but ts-ls lsp server crashes
```bash
No Project.
Error: No Project.
at Object.ThrowNoProject (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:170251:11)
at ScriptInfo.getDefaultProject (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:170998:23)
at _ProjectService.doEnsureDefaultProjectForFile (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:174123:36)
at _ProjectService.ensureDefaultProjectForFile (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:174118:75)
at IpcIOSession.getFileAndProjectWorker (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:179035:77)
at IpcIOSession.getFileAndProject (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:179021:17)
at IpcIOSession.getCodeFixes (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:179655:36)
at getCodeFixes (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:177805:43)
at /Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:179962:69
at IpcIOSession.executeWithRequestId (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:179954:14)
at IpcIOSession.executeCommand (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:179962:29)
at IpcIOSession.onMessage (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:180004:51)
at process. (/Users/richard/n/lib/node_modules/typescript/lib/tsserver.js:181571:14)
at process.emit (node:events:513:28)
at emit (node:internal/child_process:937:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21) (Unknown error)
LSP :: Error from the Language Server: TypeScript Server Error (5.0.2)
```
### System Information
https://pastebin.com/jLKFntdQ
Contributor guide
Assessment
This issue has not been assessed yet.