conf-typescript.el 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. ;;; Code:
  2. (require 'web-mode)
  3. (defun distopico:typescript-mode-hook ()
  4. "Hook to prepare `typescrip-mode'."
  5. ;; Add node_modules to exec path
  6. (distopico:add-node-modules-path)
  7. (eldoc-mode +1)
  8. (tide-hl-identifier-mode +1)
  9. ;; Add company backend for TS
  10. (set (make-local-variable 'company-backends)
  11. '(company-bbdb
  12. company-nxml company-css
  13. company-semantic company-files
  14. (company-dabbrev-code company-gtags company-etags company-keywords company-tern :with company-yasnippet)
  15. (company-dabbrev company-capf company-keywords :with company-yasnippet)))
  16. ;; Add this hook locally
  17. (add-hook 'before-save-hook 'tide-format-before-save nil 'make-it-local))
  18. (defun distopico:web-mode-hook ()
  19. (when (string-equal "tsx" (file-name-extension buffer-file-name))
  20. (distopico:typescript-mode-hook)))
  21. ;; TSX
  22. (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
  23. ;; Hooks
  24. (add-hook 'web-mode-hook #'distopico:web-mode-hook)
  25. (add-hook 'typescript-mode-hook #'distopico:typescript-mode-hook)
  26. ;;; conf-typescript.el ends here