Skip to content

Instantly share code, notes, and snippets.

@gsj987
Last active December 11, 2024 18:33
Show Gist options
  • Save gsj987/64d48bf49a374c96421ad20df886e947 to your computer and use it in GitHub Desktop.
Save gsj987/64d48bf49a374c96421ad20df886e947 to your computer and use it in GitHub Desktop.
Make eglot support tsx
(define-derived-mode typescriptreact-mode web-mode "TypescriptReact"
"A major mode for tsx.")
(use-package typescript-mode
:mode (("\\.ts\\'" . typescript-mode)
("\\.tsx\\'" . typescriptreact-mode)))
(use-package eglot
:ensure t
:defer 3
:hook
((js-mode
typescript-mode
typescriptreact-mode) . eglot-ensure)
:config
(cl-pushnew '((js-mode typescript-mode typescriptreact-mode) . ("typescript-language-server" "--stdio"))
eglot-server-programs
:test #'equal))
@berdanakyurek
Copy link

That works perfect for me, thanks. But the closing parenthesis at the end of line 14 seems extra, and I needed to remove it.

@gsj987
Copy link
Author

gsj987 commented Feb 12, 2023

That works perfect for me, thanks. But the closing parenthesis at the end of line 14 seems extra, and I needed to remove it.

thanks for your comment, i've fixed it according your feedback. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment