From 37e515a57c6279cd519a9caa3a47b6856c751877 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Fri, 8 May 2015 00:16:26 -0400 Subject: [PATCH] TypeScript layer: tweak layer - remove not necessary binding for flymake - adapt key bindings to conventions - minor reformat of README.md --- contrib/lang/typescript/README.md | 22 ++++++++++++++-------- contrib/lang/typescript/packages.el | 24 ++++++------------------ 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/contrib/lang/typescript/README.md b/contrib/lang/typescript/README.md index 55504ee84..15fc4dbd3 100644 --- a/contrib/lang/typescript/README.md +++ b/contrib/lang/typescript/README.md @@ -15,16 +15,19 @@ ## 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). +This layer adds support for TypeScript editing via [typescript-tools][] and +[emacs-tss][]. -These provide: +This layer provides: - syntax coloring - error highlighting -- autocompletion +- auto-completion via Flymake - jump-to-definition ## Install +### Layer + To use this contribution add it to your `~/.spacemacs` ```elisp @@ -33,9 +36,10 @@ To use this contribution add it to your `~/.spacemacs` ### Prerequisites -You'll need [typescript-tools](https://github.com/clausreinke/typescript-tools) and fairly obviously also the TypeScript compiler: +You'll need [typescript-tools][] and fairly obviously also the TypeScript +compiler: -``` +```sh $ npm install typescript $ git clone git://github.com/clausreinke/typescript-tools.git $ cd typescript-tools/ @@ -46,6 +50,8 @@ $ npm install -g Key Binding | Description --------------|------------------------------------------------------------ -` m h` | Show popup help (with type info) -` m d` | Jump to definition -` m c f` | Flymake check (is done automatically on save) +` m g g` | Jump to definition +` m h h` | Show popup help (with type info) + +[emacs-tss]: https://github.com/aki2o/emacs-tss +[typescript-tools]: https://github.com/clausreinke/typescript-tools diff --git a/contrib/lang/typescript/packages.el b/contrib/lang/typescript/packages.el index 04d333275..b514aa97e 100644 --- a/contrib/lang/typescript/packages.el +++ b/contrib/lang/typescript/packages.el @@ -10,26 +10,14 @@ ;; ;;; 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.") +(setq typescript-packages '(tss)) (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)))) + :mode ("\\.ts\\'" . typescript-mode) + :init (evil-leader/set-key-for-mode 'typescript-mode + "mgg" 'tss-jump-to-definition + "mhh" 'tss-popup-help) + :config (tss-config-default)))