3 ms·
I use lsp-mode and got a usable Typescript environment without too much work. I use prettier for formatting everything, so use prettier-js-mode regardless of L
by jrockway 4y ago
I use lsp-mode and got a usable Typescript environment without too much work. I use prettier for formatting everything, so use prettier-js-mode regardless of LSP support, and it works fine. (I have pretter-js-command set to "npx" and pretter-js-args set to "prettier"; this is for our internal components library which I guess has a customized version of prettier for our internal conventions in certain project. I don't really know; I didn't set it up, but it works.)
lsp-mode pretty much seems to do the right thing for Typescript projects without any configuration. At work we use React/TSX, for personal projects I use Svelte, and Emacs can find all the symbols, provide correct completions, and point out obvious mistakes. My only complaint is that I can never get Emacs's indentation to match what Prettier wants to do, so I'll type a bunch of code, prettier-on-save, and everything gets moved around. Not a big deal, but something I'd look into more deeply if I actually did Typescript full time. (I just occasionally change frontend stuff, but mostly program Go. gofmt and Emacs agree on formatting, but I think that's because Go is opinionated about formatting and so it's easier for multiple tools to have the same opinion. With Typescript, anything goes.)
TL;DR: despite the eglot marketing campaign and its overall cleaner design, lsp-mode might be the thing for you. I try eglot every 6 months and always switch back to lsp-mode. It has its quirks and WTFs, but doesn't get in my way too much.
- bananadonkey 4y ago> My only complaint is that I can never get Emacs's indentation to match what Prettier wants to do, so I'll type a bunch of code, prettier-on-save, and everything gets moved around. I had this same issue, and it was annoying enough I continued to use https://github.com/editorconfig/editorconfig-emacs https://github.com/editorconfig/editorconfig-emacs alongside prettier. This does create another annoyance in having to configure editorconfig for new projects instead of relying on prettier alone.
- jrockway 4y agoOoooh neat. Thank you so much for sharing, that's exactly what I was looking for!