Skip to content

Commit d4ba082

Browse files
committed
feat(emacs): support typescript-mode in Eglot plugin
Teach our Emacs plugin to register the quick-lint-js LSP server in Eglot for typescript-mode. This lets Eglot users enable quick-lint-js in .ts files.
1 parent 11cf302 commit d4ba082

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Semantic Versioning.
1616
* `typeof myVar === undefined` now reports [E0458][] ("typeof result is of type
1717
string and so will never equal undefined; use 'undefined' instead").
1818
(Implemented by [CoderMuffin][].) ([#1207][])
19+
* Emacs: The Eglot plugin now supports `typescript-mode`.
1920

2021
### Fixed
2122

plugin/emacs/eglot-quicklintjs.el

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
;; ;; Optional: Make Eglot run automatically when `js-mode' is loaded
1919
;; (eglot-ensure))
2020
;; (add-hook 'js-mode-hook #'my-eglot-quicklintjs-setup)
21+
;; (add-hook 'typescript-mode-hook #'my-eglot-quicklintjs-setup)
2122

2223
;;; Code:
2324

@@ -38,9 +39,10 @@
3839
:group 'eglot-quicklintjs
3940
:type '(repeat string))
4041

41-
(add-to-list 'eglot-server-programs `(js-mode . (,eglot-quicklintjs-program
42-
"--lsp-server"
43-
,@eglot-quicklintjs-args)))
42+
(add-to-list 'eglot-server-programs
43+
`((js-mode typescript-mode) . (,eglot-quicklintjs-program
44+
"--lsp-server"
45+
,@eglot-quicklintjs-args)))
4446

4547
(provide 'eglot-quicklintjs)
4648

website/public/install/emacs/configure/index.ejs.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ <h2 id="eglot">Eglot</h2>
5050
<code>eglot-quicklintjs</code> library:
5151
</p>
5252
<pre><code class="elisp">(require 'eglot-quicklintjs)</code></pre>
53-
<p>
54-
TODO:
55-
<a href="https://github.com/quick-lint/quick-lint-js/issues/1146"
56-
>TypeScript support</a
57-
>
58-
</p>
5953
<p>
6054
To speed up JavaScript linting, configure Eglot to send changes to
6155
quick-lint-js immediately without delay by adding the following to your
@@ -67,9 +61,11 @@ <h2 id="eglot">Eglot</h2>
6761
;; checking buffer. The default is 0.5 (500ms)
6862
(setq-local eglot-send-changes-idle-time 0)
6963

70-
;; Optional: Make Eglot run automatically when `js-mode' is loaded
64+
;; Optional: Make Eglot run automatically when `js-mode' or `typescript-mode'
65+
;; is loaded.
7166
(eglot-ensure))
72-
(add-hook 'js-mode-hook #'my-eglot-quicklintjs-setup)</code></pre>
67+
(add-hook 'js-mode-hook #'my-eglot-quicklintjs-setup)
68+
(add-hook 'typescript-mode-hook #'my-eglot-quicklintjs-setup)</code></pre>
7369

7470
<h2 id="flycheck">Flycheck</h2>
7571
<p>

0 commit comments

Comments
 (0)