use typescript-ts-mode and tsx-ts-mode at first
This commit is contained in:
10 files changed
+30
-14
No files matched your search
+8
-8
@@ -88,17 +88,17 @@
|
||||
[submodule "site-lisp/editorconfig-emacs"]
|
||||
path = site-lisp/editorconfig-emacs
|
||||
url = https://github.com/editorconfig/editorconfig-emacs.git
|
||||
[submodule "site-lisp/typescript"]
|
||||
path = site-lisp/typescript
|
||||
[submodule "optional-pkg/typescript"]
|
||||
path = optional-pkg/typescript
|
||||
url = https://github.com/emacs-typescript/typescript.el.git
|
||||
[submodule "site-lisp/elisp-tree-sitter"]
|
||||
path = site-lisp/elisp-tree-sitter
|
||||
[submodule "optional-pkg/elisp-tree-sitter"]
|
||||
path = optional-pkg/elisp-tree-sitter
|
||||
url = https://github.com/emacs-tree-sitter/elisp-tree-sitter.git
|
||||
[submodule "site-lisp/tree-sitter-langs"]
|
||||
path = site-lisp/tree-sitter-langs
|
||||
[submodule "optional-pkg/tree-sitter-langs"]
|
||||
path = optional-pkg/tree-sitter-langs
|
||||
url = https://github.com/emacs-tree-sitter/tree-sitter-langs.git
|
||||
[submodule "site-lisp/tsi"]
|
||||
path = site-lisp/tsi
|
||||
[submodule "optional-pkg/tsi"]
|
||||
path = optional-pkg/tsi
|
||||
url = https://github.com/orzechowskid/tsi.el.git
|
||||
[submodule "site-lisp/prettier"]
|
||||
path = site-lisp/prettier
|
||||
|
||||
@@ -55,7 +55,10 @@
|
||||
|
||||
(defun creature/awesome-pair-kill ()
|
||||
(interactive)
|
||||
(cond ((and (derived-mode-p 'js-mode 'typescript-mode 'web-mode)
|
||||
(cond ((and (derived-mode-p 'js-mode
|
||||
'typescript-mode
|
||||
'typescript-ts-base-mode
|
||||
'web-mode)
|
||||
(creature/awesome-pair-in-template-string-p)
|
||||
(awesome-pair-in-curly-p))
|
||||
(creature/awesome-pair-kill-template-string-curly-content))
|
||||
|
||||
+5
-1
@@ -21,7 +21,11 @@
|
||||
(unless (derived-mode-p 'js-json-mode 'json-mode)
|
||||
(eglot-ensure))))
|
||||
|
||||
(dolist (hook '(css-mode-hook typescript-mode-hook c-mode-hook c++-mode-hook))
|
||||
(dolist (hook '(css-mode-hook
|
||||
typescript-mode-hook
|
||||
typescript-ts-base-mode-hook
|
||||
c-mode-hook
|
||||
c++-mode-hook))
|
||||
(add-hook hook #'eglot-ensure))
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,10 @@
|
||||
|
||||
(when (and flymake-mode
|
||||
(not creature/eslint-inited)
|
||||
(derived-mode-p 'js-mode 'typescript-mode 'web-mode))
|
||||
(derived-mode-p 'js-mode
|
||||
'typescript-mode
|
||||
'typescript-ts-base-mode
|
||||
'web-mode))
|
||||
|
||||
;; flymake-eslint-enable 内部会再次调用 (flymake-mode 1) ,为防止无限
|
||||
;; 循环调用,用 ‘creature/eslint-inited’ 记录该函数调用状态避免多次调用
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
(add-to-list 'prettier-major-mode-parsers
|
||||
'(js-json-mode . creature/prettier-json-parser)))
|
||||
|
||||
(dolist (hook '(css-mode-hook js-mode-hook typescript-mode-hook))
|
||||
(dolist (hook '(css-mode-hook
|
||||
js-mode-hook
|
||||
typescript-mode-hook
|
||||
typescript-ts-base-mode-hook))
|
||||
(add-hook hook #'prettier-mode))
|
||||
|
||||
(provide 'init-prettier)
|
||||
@@ -1,8 +1,9 @@
|
||||
;; -*- coding: utf-8; lexical-binding: t; -*-
|
||||
|
||||
(unless (and (fboundp 'treesit-available-p) (treesit-available-p))
|
||||
(add-subdirs-to-load-path (expand-file-name "optional-pkg" creature/config-dir))
|
||||
(require 'typescript-mode)
|
||||
|
||||
|
||||
(define-derived-mode typescript-tsx-mode typescript-mode "Tsx"
|
||||
"Major mode for editing TSX file."
|
||||
(require 'tree-sitter)
|
||||
@@ -18,7 +19,9 @@
|
||||
|
||||
(with-eval-after-load 'tree-sitter-langs
|
||||
(tree-sitter-require 'tsx)
|
||||
(add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx)))
|
||||
(add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx))))
|
||||
|
||||
|
||||
|
||||
|
||||
(provide 'init-typescript)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user