Is there a reasonably functional, up-to-date, Emacs mode for TypeScript? There doesn't seem to be an official one, or least an official one that is actively updated.
There is a Microsoft one here, but it is old and doesn't incorporate the latest language changes (e.g. boolean
as a keyword in addition to bool
). This one looks similar, as does this one which claims to be more sophisticated.
All suffer from the following problem. In the example below, borderRadius
is coloured differently from borderWidth
and fontSize
, presumably because the syntax colouring isn't coping properly with multiple variables introduced by a single var
declaration.
var borderRadius: number = 4,
borderWidth: number = 2,
fontSize: number = 9;
The up-to-date modes are the following: http://wikemacs.org/wiki/TypeScript
It is in MELPA so easy to install.
screencast:
There is also an error checker, for flycheck, that uses tslint.
Spacemacs has a Typescript layer: https://spacemacs.org/layers/+lang/typescript/README.html
it also includes an optional code formatter (https://github.com/vvakame/typescript-formatter).
there is also emacs-tss that uses typescript-tools, but it is less active than the others. See the wiki.
For the minimalist, there's also typescript.el
. It
is a self-contained, lightweight and minimalist major-mode focused on providing basic font-lock/syntax-highlighting and indentation for Typescript syntax, without any external dependencies.
It supports tsc
and tslint
.
emacs-tss includes a major mode, as you note. Since this package is maintained and available on MELPA, I suggest you use that and file these bugs there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With