diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2022-10-02 13:14:30 +0200 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2022-10-02 13:14:30 +0200 |
commit | 8be594c57030e1f082dbbfef1f4e88e0ef1c50f3 (patch) | |
tree | a38076034d0d4c6658ccfd83d1cb67e201769221 | |
parent | e5b488e92f64fb053162632ca31417536d9a7f9b (diff) | |
download | dotfiles-8be594c57030e1f082dbbfef1f4e88e0ef1c50f3.tar.gz dotfiles-8be594c57030e1f082dbbfef1f4e88e0ef1c50f3.zip |
Change settings in typescript mode
-rw-r--r-- | Emacs.org | 33 |
1 files changed, 27 insertions, 6 deletions
@@ -662,25 +662,46 @@ | |||
662 | 662 | ||
663 | #+end_src | 663 | #+end_src |
664 | 664 | ||
665 | *** Type Script | 665 | *** TypeScript |
666 | 666 | ||
667 | #+begin_src emacs-lisp | 667 | #+begin_src emacs-lisp |
668 | 668 | ||
669 | (use-package typescript-mode | 669 | (use-package typescript-mode |
670 | :mode ("\\.ts\\'") | ||
670 | :config | 671 | :config |
671 | (setq typescript-indent-level 2) | 672 | (setq typescript-indent-level 2)) |
672 | (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))) | 673 | |
674 | (defun jd/activate-tide-mode () | ||
675 | (when (and (stringp buffer-file-name) | ||
676 | (string-match "\\.[tj]sx?\\'" buffer-file-name)) | ||
677 | (tide-setup) | ||
678 | (tide-hl-identifier-mode))) | ||
673 | 679 | ||
674 | (use-package tide | 680 | (use-package tide |
675 | :ensure t | 681 | :ensure t |
676 | :after (typescript-mode company) | 682 | :after (typescript-mode company web-mode)) |
677 | :hook ((typescript-mode . tide-setup) | ||
678 | (typescript-mode . tide-hl-identifier-mode))) | ||
679 | 683 | ||
680 | (use-package flycheck | 684 | (use-package flycheck |
681 | :ensure t | 685 | :ensure t |
682 | :hook ((after-init . global-flycheck-mode))) | 686 | :hook ((after-init . global-flycheck-mode))) |
683 | 687 | ||
688 | (use-package web-mode | ||
689 | :ensure t | ||
690 | :hook ((web-mode . jd/activate-tide-mode)) | ||
691 | :mode | ||
692 | ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'") | ||
693 | :config | ||
694 | (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'"))) | ||
695 | (setq web-mode-markup-indent-offset 2) | ||
696 | (setq web-mode-css-indent-offset 2) | ||
697 | (setq web-mode-code-indent-offset 2) | ||
698 | (setq web-mode-script-padding 2) | ||
699 | (setq web-mode-block-padding 2) | ||
700 | (setq web-mode-style-padding 2) | ||
701 | (setq web-mode-enable-auto-pairing t) | ||
702 | (setq web-mode-enable-auto-closing t) | ||
703 | (setq web-mode-enable-current-element-highlight t)) | ||
704 | |||
684 | #+end_src | 705 | #+end_src |
685 | 706 | ||
686 | *** Yaml | 707 | *** Yaml |