From 8be594c57030e1f082dbbfef1f4e88e0ef1c50f3 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sun, 2 Oct 2022 13:14:30 +0200 Subject: Change settings in typescript mode --- Emacs.org | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Emacs.org b/Emacs.org index 4323e29..13f1dd5 100644 --- a/Emacs.org +++ b/Emacs.org @@ -662,25 +662,46 @@ #+end_src -*** Type Script +*** TypeScript #+begin_src emacs-lisp (use-package typescript-mode + :mode ("\\.ts\\'") :config - (setq typescript-indent-level 2) - (add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))) + (setq typescript-indent-level 2)) + + (defun jd/activate-tide-mode () + (when (and (stringp buffer-file-name) + (string-match "\\.[tj]sx?\\'" buffer-file-name)) + (tide-setup) + (tide-hl-identifier-mode))) (use-package tide :ensure t - :after (typescript-mode company) - :hook ((typescript-mode . tide-setup) - (typescript-mode . tide-hl-identifier-mode))) + :after (typescript-mode company web-mode)) (use-package flycheck :ensure t :hook ((after-init . global-flycheck-mode))) + (use-package web-mode + :ensure t + :hook ((web-mode . jd/activate-tide-mode)) + :mode + ("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'") + :config + (setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'"))) + (setq web-mode-markup-indent-offset 2) + (setq web-mode-css-indent-offset 2) + (setq web-mode-code-indent-offset 2) + (setq web-mode-script-padding 2) + (setq web-mode-block-padding 2) + (setq web-mode-style-padding 2) + (setq web-mode-enable-auto-pairing t) + (setq web-mode-enable-auto-closing t) + (setq web-mode-enable-current-element-highlight t)) + #+end_src *** Yaml -- cgit v1.2.3