Skip to content

Commit 02a2bb9

Browse files
committed
Add usage instructions for typescript-comint REPL integration in README
1 parent 9a741ad commit 02a2bb9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,31 @@ to `false`: `tsc --pretty false`. However, doing this does more than
7575
just turning off the colors. It also causes `tsc` to produce less
7676
elaborate error messages.
7777

78+
## Using `typescript-comint`
79+
80+
`typescript-comint.el` ships with this repository and exposes a simple REPL that integrates with `typescript-mode`.
81+
82+
1. Ensure `typescript-comint.el` is on your `load-path` (it is if you install the package normally).
83+
2. Start a REPL with `M-x typescript-run-repl`. Use `C-u M-x typescript-run-repl` to edit the command line if you need a different interpreter than the default `tsun`.
84+
3. From a `typescript-mode` buffer, send code to the REPL using:
85+
- `M-x typescript-send-last-sexp`
86+
- `M-x typescript-send-region`
87+
- `M-x typescript-send-buffer`
88+
The `-and-go` variants will switch to the REPL after sending.
89+
4. Load files directly into the REPL with `M-x typescript-load-file` (or `typescript-load-file-and-go`).
90+
5. Switch to the REPL at any time with `M-x typescript-switch-to-repl`.
91+
92+
Example minimal setup:
93+
94+
```elisp
95+
(add-hook 'typescript-mode-hook
96+
(lambda ()
97+
(local-set-key (kbd "C-c C-z") #'typescript-run-repl)
98+
(local-set-key (kbd "C-x C-e") #'typescript-send-last-sexp)
99+
(local-set-key (kbd "C-c C-b") #'typescript-send-buffer-and-go)
100+
(local-set-key (kbd "C-c l") #'typescript-load-file-and-go)))
101+
```
102+
78103
# Contributing
79104

80105
To run the tests you can run `make test`.

0 commit comments

Comments
 (0)