Skip to content

Commit

Permalink
Updating Typescript to use Flycheck rather than Flymake
Browse files Browse the repository at this point in the history
add hooks for flycheck while stripping out flymake.

As all other packages are written to depend on flycheck, I thought I would strip it out of this package to let us have a consistent interface in all layers.

Add author.

Cleanup of package.el
  • Loading branch information
Hamish Hutchings committed Sep 8, 2015
1 parent 88d30d7 commit 75ebbe8
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions contrib/!lang/typescript/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,50 @@
;; Copyright (c) 2014-2015 Chris Bowdon & Contributors
;;
;; Author: Chris Bowdon <c.bowdon@bath.edu>
;; Author: Hamish Hutchings <hamhut1066@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

(setq typescript-packages '(tss))
(setq typescript-packages '(
tss
flycheck))

(setq test-layer-excluded-packages '())

(defun typescript/post-init-flycheck ()
"Add hook for flycheck"
(use-package flycheck
:defer t
:config
(progn
;; ;;; remove hook for flymake, as it seems to conflict.
;; (add-hook 'typescript-mode-hook 'flycheck-mode (flymake-mode nil))
;; (add-hook 'typescript-mode-hook (lambda flymake-mode nil))
;;; This Code Snippet was from [Here](https://github.com/caisah/flycheck-typescript) and is licensed under the GPL
(flycheck-define-checker typescript
"A TypeScript syntax checker using tsc command."
:command ("tsc" "--out" "/dev/null" source-inplace)
:error-patterns
((error line-start (file-name) "(" line "," column "): error " (message) line-end))
:modes (typescript-mode))

(add-to-list 'flycheck-checkers 'typescript))))

(defun typescript/init-tss ()
"Initialize my package"
"Initialize tss"
(use-package tss
:defer t
:mode ("\\.ts\\'" . typescript-mode)
:init (evil-leader/set-key-for-mode 'typescript-mode
:init (evil-leader/set-key-for-mode 'flycheck-mode
"mgg" 'tss-jump-to-definition
"mhh" 'tss-popup-help)
:config (tss-config-default)))
:config
(progn
;; Remove Flymake mode from hook.
(advice-add 'tss-setup-current-buffer :before (lambda flymake-mode nil))

(add-hook 'typescript-mode-hook 'tss-setup-current-buffer t)
(add-hook 'kill-buffer-hook 'tss--delete-process t))))

0 comments on commit 75ebbe8

Please sign in to comment.