Update typescript and tsx for emacs29.
This commit is contained in:
parent
6559f212c0
commit
ac95e4b889
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
(require 'lang-python)
|
(require 'lang-python)
|
||||||
|
|
||||||
;; (require 'lang-javascript)
|
(require 'lang-javascript)
|
||||||
|
|
||||||
(require 'lang-rust)
|
(require 'lang-rust)
|
||||||
|
|
||||||
|
@ -1,61 +1,87 @@
|
|||||||
(require 'common-lsp)
|
(require 'common-lsp)
|
||||||
(require 'util-tree-sitter)
|
(require 'util-tree-sitter)
|
||||||
|
|
||||||
(use-package js
|
(use-package tsx-ts-mode
|
||||||
:mode (
|
:ensure nil
|
||||||
("\\.js\\'" . js-mode)
|
|
||||||
("\\.json\\'" . js-mode)
|
|
||||||
)
|
|
||||||
:commands js-mode
|
|
||||||
:pin manual
|
:pin manual
|
||||||
:hook (
|
|
||||||
(find-file . (lambda () (when (string= (file-name-extension buffer-file-name) "json") (add-hook 'before-save-hook 'json-fmt-jq nil 'local))))
|
|
||||||
(js-mode . (lambda ()
|
|
||||||
(tree-sitter-hl-mode +1)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
:config
|
|
||||||
(setq js-indent-level 2)
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package typescript-mode
|
|
||||||
:mode (
|
:mode (
|
||||||
("\\.ts\\'" . typescript-mode)
|
("\\.tsx\\'" . tsx-ts-mode)
|
||||||
("\\.tsx\\'" . typescript-mode)
|
|
||||||
)
|
)
|
||||||
:hook (
|
:commands (tsx-ts-mode)
|
||||||
(typescript-mode . (lambda ()
|
:init
|
||||||
;; (lsp-register-client
|
(add-to-list 'treesit-language-source-alist '(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")))
|
||||||
;; (make-lsp-client :new-connection (lsp-stdio-connection '("deno" "lsp" --compat --unstable --allow-read))
|
(unless (treesit-ready-p 'tsx) (treesit-install-language-grammar 'tsx))
|
||||||
;; :major-modes '(typescript-mode)
|
|
||||||
;; :server-id 'typescript-ls))
|
|
||||||
(eglot-ensure)
|
|
||||||
(tree-sitter-hl-mode +1)
|
|
||||||
))
|
|
||||||
;; (before-save . lsp-format-buffer)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(defun json-fmt-jq ()
|
|
||||||
"Run jq."
|
|
||||||
(run-command-on-buffer "jq" "--monochrome-output" ".")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(use-package web-mode
|
|
||||||
:mode (("\\.dust\\'" . web-mode)
|
(use-package typescript-ts-mode
|
||||||
|
:ensure nil
|
||||||
|
:pin manual
|
||||||
|
:mode (
|
||||||
|
("\\.ts\\'" . typescript-ts-mode)
|
||||||
)
|
)
|
||||||
:config
|
:commands (typescript-ts-mode)
|
||||||
(setq web-mode-markup-indent-offset 2)
|
:init
|
||||||
(setq web-mode-enable-current-element-highlight t)
|
(add-to-list 'treesit-language-source-alist '(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")))
|
||||||
|
(unless (treesit-ready-p 'typescript) (treesit-install-language-grammar 'typescript))
|
||||||
)
|
)
|
||||||
|
|
||||||
;; Define a custom mode for dust so that org-mode handle #+BEGIN_SRC dust blocks
|
|
||||||
(define-derived-mode dust-mode web-mode "WebDust"
|
;; (use-package js
|
||||||
"Major mode for editing dust templates in web-mode."
|
;; :mode (
|
||||||
(web-mode)
|
;; ("\\.js\\'" . js-mode)
|
||||||
(web-mode-set-engine "dust")
|
;; ("\\.json\\'" . js-mode)
|
||||||
;; (setq web-mode-content-type "html")
|
;; )
|
||||||
)
|
;; :commands js-mode
|
||||||
|
;; :pin manual
|
||||||
|
;; :hook (
|
||||||
|
;; (find-file . (lambda () (when (string= (file-name-extension buffer-file-name) "json") (add-hook 'before-save-hook 'json-fmt-jq nil 'local))))
|
||||||
|
;; (js-mode . (lambda ()
|
||||||
|
;; (tree-sitter-hl-mode +1)
|
||||||
|
;; )
|
||||||
|
;; )
|
||||||
|
;; )
|
||||||
|
;; :config
|
||||||
|
;; (setq js-indent-level 2)
|
||||||
|
;; )
|
||||||
|
|
||||||
|
;; (use-package typescript-mode
|
||||||
|
;; :mode (
|
||||||
|
;; ("\\.ts\\'" . typescript-mode)
|
||||||
|
;; ("\\.tsx\\'" . typescript-mode)
|
||||||
|
;; )
|
||||||
|
;; :hook (
|
||||||
|
;; (typescript-mode . (lambda ()
|
||||||
|
;; ;; (lsp-register-client
|
||||||
|
;; ;; (make-lsp-client :new-connection (lsp-stdio-connection '("deno" "lsp" --compat --unstable --allow-read))
|
||||||
|
;; ;; :major-modes '(typescript-mode)
|
||||||
|
;; ;; :server-id 'typescript-ls))
|
||||||
|
;; (eglot-ensure)
|
||||||
|
;; (tree-sitter-hl-mode +1)
|
||||||
|
;; ))
|
||||||
|
;; ;; (before-save . lsp-format-buffer)
|
||||||
|
;; )
|
||||||
|
;; )
|
||||||
|
|
||||||
|
;; (defun json-fmt-jq ()
|
||||||
|
;; "Run jq."
|
||||||
|
;; (run-command-on-buffer "jq" "--monochrome-output" ".")
|
||||||
|
;; )
|
||||||
|
|
||||||
|
;; (use-package web-mode
|
||||||
|
;; :mode (("\\.dust\\'" . web-mode)
|
||||||
|
;; )
|
||||||
|
;; :config
|
||||||
|
;; (setq web-mode-markup-indent-offset 2)
|
||||||
|
;; (setq web-mode-enable-current-element-highlight t)
|
||||||
|
;; )
|
||||||
|
|
||||||
|
;; ;; Define a custom mode for dust so that org-mode handle #+BEGIN_SRC dust blocks
|
||||||
|
;; (define-derived-mode dust-mode web-mode "WebDust"
|
||||||
|
;; "Major mode for editing dust templates in web-mode."
|
||||||
|
;; (web-mode)
|
||||||
|
;; (web-mode-set-engine "dust")
|
||||||
|
;; ;; (setq web-mode-content-type "html")
|
||||||
|
;; )
|
||||||
|
|
||||||
(provide 'lang-javascript)
|
(provide 'lang-javascript)
|
||||||
|
Loading…
Reference in New Issue
Block a user