Skip to content
TypeScript-support for Emacs
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test-files Fix indentation after keyword-lookalike methods. Sep 14, 2018
.gitignore We need a Gitignore-file. Mar 7, 2017
.travis.yml We no longer support 24.3, fixes #100. Mar 6, 2019
Cask prepare for melpa Jun 9, 2015
LICENSE
Makefile Add file for jsdoc tests Oct 11, 2018
README.md Fixes typo in the README file. Dec 30, 2018
typescript-mode-general-tests.el Highlight multiple implements types (#96) Dec 20, 2018
typescript-mode-jsdoc-tests.el
typescript-mode-test-utilities.el Extract test utilities Oct 11, 2018
typescript-mode-tests.el Add file for jsdoc tests Oct 11, 2018
typescript-mode.el checkdoc fixes Dec 21, 2018

README.md

typescript.el

Build Status

typescript.el is major-mode for editing Typescript-files in GNU Emacs.

typescript.el 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.

Output from tsc and tslint is also handled seamlessly through compilation-mode.

Installation

typescript.el can be installed from source directly using your favourite approach or framework, or from MELPA and MELPA Stable as a package.

To install typescript.el simply type M-x package-install<RET>typescript-mode<RET>.

Customization

To customize typescript.el just type the following: M-x customize-group<RET>typescript<RET>.

You can add any other customization you like to typescript-mode-hook in your init.el file. typescript.el also handles prog-mode-hook on versions of Emacs which supports it.

Support for Compilation Mode

This mode automatically adds support for compilation-mode so that if you run M-x compile<ret>tsc<ret> the error messages are correctly parsed.

However, the error messages produced by tsc when its pretty flag is turned on include ANSI color escapes, which by default compilation-mode does not interpret. In order to get the escapes parsed, you can use:

(require 'ansi-color)
(defun colorize-compilation-buffer ()
  (ansi-color-apply-on-region compilation-filter-start (point-max)))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)

Or, if you prefer, you can configure tsc with the pretty flag set to false: tsc --pretty false. However, doing this does more than just turning off the colors. It also causes tsc to produce less elaborate error messages.

Other Typescript-packages of interest

While typescript.el may not provide a full kitchen-sink, the good news is that there's other packages which do!

More advanced features can be provided by using these additional packages:

  • tide - TypeScript Interactive Development Environment for Emacs
  • ts-comint - a Typescript REPL in Emacs.

Initialization these with typescript.el will then become a matter of creating your own typescript-mode-hook in your init.el file.

You can’t perform that action at this time.