Add TypeScript configuration layer

This commit is contained in:
Chris Bowdon 2015-04-14 22:43:50 +01:00 committed by syl20bnr
parent 68e8b3e524
commit f9fa443f83
3 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,51 @@
# TypeScript contribution layer for Spacemacs
![logo](img/TypeScript.png)
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc/generate-toc again -->
**Table of Contents**
- [TypeScript contribution layer for Spacemacs](#typescript-contribution-layer-for-spacemacs)
- [Description](#description)
- [Install](#install)
- [Prerequisites](#prerequisites)
- [Key bindings](#key-bindings)
<!-- markdown-toc end -->
## Description
This adds support for TypeScript editing via [typescript-tools](https://github.com/clausreinke/typescript-tools) and [emacs-tss](https://github.com/aki2o/emacs-tss).
These provide:
- syntax coloring
- error highlighting
- autocompletion
- jump-to-definition
## Install
To use this contribution add it to your `~/.spacemacs`
```elisp
(setq-default dotspacemacs-configuration-layers '(typescript))
```
### Prerequisites
You'll need [typescript-tools](https://github.com/clausreinke/typescript-tools) and fairly obviously also the TypeScript compiler:
```
$ npm install typescript
$ git clone git://github.com/clausreinke/typescript-tools.git
$ cd typescript-tools/
$ npm install -g
```
## Key bindings
Key Binding | Description
--------------|------------------------------------------------------------
`<SPC> m h` | Show popup help (with type info)
`<SPC> m d` | Jump to definition
`<SPC> m c f` | Flymake check (is done automatically on save)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -0,0 +1,35 @@
;;; packages.el --- typescript Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Chris Bowdon & Contributors
;;
;; Author: Chris Bowdon <c.bowdon@bath.edu>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(defvar typescript-packages '(tss)
"List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")
(defvar typescript-excluded-packages '()
"List of packages to exclude.")
(defun typescript/init-tss ()
"Initialize my package"
(use-package tss
:mode ("\\.ts\\'" . typescript-mode)
:defer t
:init
(progn
(require 'typescript)
(require 'tss)
(evil-leader/set-key-for-mode 'typescript-mode
"mh" 'tss-popup-help
"md" 'tss-jump-to-definition
"mcf" 'tss-run-flymake))
:config
(progn
(tss-config-default))))