|
6 | 6 |
|
7 | 7 | ## Packages |
8 | 8 |
|
9 | | -- [typescript-mode](https://github.com/emacs-typescript/typescript.el) - |
10 | | - major mode for TypeScript |
11 | | -- [tide](https://github.com/ananthakumaran/tide) - TypeScript |
12 | | - Interactive Development Environment |
| 9 | +This module relies on Emacs' built-in tree-sitter support and LSP, so it |
| 10 | +doesn't pull in any third-party packages: |
| 11 | + |
| 12 | +- `typescript-ts-mode` / `tsx-ts-mode` - tree-sitter powered major modes |
| 13 | + for TypeScript and TSX (built into Emacs 29+) |
13 | 14 |
|
14 | 15 | ## Features |
15 | 16 |
|
16 | | -Tide provides a rich development experience for TypeScript: |
| 17 | +Code intelligence is provided by an LSP server (Eglot by default): |
17 | 18 |
|
18 | 19 | - Code completion (via company-mode) |
19 | | -- Syntax checking (via Flycheck) |
| 20 | +- Syntax checking (via Flymake or Flycheck) |
20 | 21 | - Eldoc integration for inline type information |
21 | | -- Identifier highlighting (`tide-hl-identifier-mode`) |
22 | | -- Format on save (when `prelude-format-on-save` is enabled) |
| 22 | +- Navigation, refactoring, and documentation lookup |
23 | 23 |
|
24 | 24 | ## Prerequisites |
25 | 25 |
|
26 | | -You need [Node.js](https://nodejs.org/) and `tsserver` (bundled with TypeScript) |
27 | | -installed. Install TypeScript globally: |
| 26 | +The tree-sitter modes need the TypeScript grammars installed. You can grab |
| 27 | +them with: |
28 | 28 |
|
29 | | -```sh |
30 | | -npm install -g typescript |
| 29 | +```emacs-lisp |
| 30 | +(treesit-install-language-grammar 'typescript) |
| 31 | +(treesit-install-language-grammar 'tsx) |
31 | 32 | ``` |
32 | 33 |
|
33 | | -## Configuration |
34 | | - |
35 | | -### Format on Save |
| 34 | +For code intelligence you need [Node.js](https://nodejs.org/) and a language |
| 35 | +server. The default is |
| 36 | +[typescript-language-server](https://github.com/typescript-language-server/typescript-language-server): |
36 | 37 |
|
37 | | -By default, Tide formats the buffer before saving when `prelude-format-on-save` |
38 | | -is enabled. You can customize the format action: |
| 38 | +```sh |
| 39 | +npm install -g typescript typescript-language-server |
| 40 | +``` |
39 | 41 |
|
40 | | -```emacs-lisp |
41 | | -;; Disable format on save for TypeScript |
42 | | -(setq prelude-format-on-save nil) |
| 42 | +## Format on Save |
43 | 43 |
|
44 | | -;; Or use a different formatter |
45 | | -(setq prelude-ts-format-action #'my-custom-format-function) |
46 | | -``` |
| 44 | +For automatic formatting on save, enable the |
| 45 | +[Apheleia](apheleia.md) module. It runs `prettier` (or another configured |
| 46 | +formatter) asynchronously whenever you save a TypeScript buffer. |
0 commit comments