Add support for working with typescript

This commit is contained in:
2018-11-06 11:27:42 +00:00
parent dc4b0910a7
commit 1cb89d07ce
3 changed files with 70 additions and 1 deletions

View File

@@ -132,6 +132,7 @@
(require 'siren-slim)
(require 'siren-text-mode)
(require 'siren-thrift)
(require 'siren-typescript)
(require 'siren-web-mode)
(require 'siren-yaml)

View File

@@ -7,7 +7,7 @@
'(magit-commit-arguments (quote ("-S")))
'(package-selected-packages
(quote
(zoom-window yasnippet-snippets yari yaml-mode which-key web-mode use-package toggle-quotes thrift string-inflection smex smartparens smart-shift smart-mode-line slim-mode seeing-is-believing scss-mode sass-mode rust-playground ruby-tools ruby-refactor ruby-compilation rubocop rspec-mode robe rjsx-mode restart-emacs resize-window realgud-byebug realgud rainbow-mode racer prettier-js plantuml-mode php-mode phi-search nlinum neotree multiple-cursors move-dup markdown-mode magit-gh-pulls lua-mode linum-relative json-mode imenu-anywhere ido-vertical-mode ido-completing-read+ hlinum highlight-symbol highlight-indentation highlight-indent-guides helpful helm-swoop helm-projectile helm-open-github helm-gtags helm-describe-modes helm-descbinds helm-ag go-projectile go-playground go-dlv gitignore-mode github-browse-file gitconfig-mode git-timemachine git-link full-ack flycheck-rust flycheck-package flycheck-gometalinter fill-column-indicator feature-mode expand-region exec-path-from-shell evil eslintd-fix editorconfig dumb-jump doom-themes dockerfile-mode direx dired-subtree diminish diff-hl dash-at-point company-go coffee-mode cargo buffer-move browse-kill-ring anzu airline-themes ace-window))))
(zoom-window yasnippet-snippets yari yaml-mode which-key web-mode use-package typescript-mode toggle-quotes tide thrift string-inflection smex smartparens smart-mode-line slim-mode seeing-is-believing scss-mode sass-mode rust-playground ruby-tools ruby-refactor ruby-compilation rubocopfmt rubocop rspec-mode robe rjsx-mode restart-emacs resize-window realgud-byebug rainbow-mode racer prettier-js plantuml-mode php-mode phi-search neotree nav multiple-cursors move-dup magit-gh-pulls lua-mode linum-relative json-mode imenu-anywhere ido-vertical-mode ido-completing-read+ hlinum highlight-symbol highlight-indentation highlight-indent-guides helpful helm-swoop helm-projectile helm-open-github helm-gtags helm-describe-modes helm-descbinds helm-ag go-projectile go-playground go-dlv gitignore-mode github-browse-file gitconfig-mode git-timemachine git-link full-ack flycheck-rust flycheck-gometalinter fill-column-indicator feature-mode expand-region exec-path-from-shell evil eslintd-fix editorconfig dumb-jump doom-themes dockerfile-mode direx diminish diff-hl dash-at-point company-go coffee-mode cargo buffer-move browse-kill-ring anzu ace-window))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.

View File

@@ -0,0 +1,68 @@
;;; siren-typescript.el --- jimeh's Emacs Siren: typescript-mode configuration.
;;; Commentary:
;; Basic configuration for typescript-mode.
;;; Code:
(require 'siren-company)
(require 'siren-folding)
(require 'siren-flycheck)
(require 'siren-highlight-indentation)
(require 'siren-prettier-js)
(require 'siren-web-mode)
(use-package typescript-mode
:hook
(typescript-mode . siren-typescript-mode-setup)
:init
(defun siren-typescript-mode-setup ()
(let ((width 2))
(setq typescript-indent-level width
indent-level width
tab-width width))
(company-mode +1)
(subword-mode +1)
(hs-minor-mode 1)
(highlight-indentation-current-column-mode)
(hideshowvis-enable)
(let ((map typescript-mode-map))
(define-key map (kbd "C-j") 'newline-and-indent)
(define-key map (kbd "C-c C-h") 'siren-toggle-hiding))))
(use-package tide
:hook
;; (before-save . tide-format-before-save)
(typescript-mode . siren-tide-mode-setup)
(web-mode . siren-tide-web-mode-setup)
:init
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
(eval-after-load 'flycheck
'(progn
(flycheck-add-mode 'typescript-tslint 'web-mode)))
(defun siren-tide-web-mode-setup ()
(when (string-equal "tsx" (file-name-extension buffer-file-name))
(siren-tide-mode-setup)))
(defun siren-tide-mode-setup ()
(interactive)
(tide-setup)
(setq flycheck-check-syntax-automatically '(save mode-enabled)
company-tooltip-align-annotations t)
(prettier-js-mode +1)
(flycheck-mode +1)
(eldoc-mode +1)
(tide-hl-identifier-mode +1)
(company-mode +1)))
(provide 'siren-typescript)
;;; siren-typescript.el ends here