mirror of
https://github.com/larstvei/dot-emacs.git
synced 2024-11-26 07:28:31 +00:00
clean up webdev setup
This commit is contained in:
parent
a059ca5b08
commit
73ba7b2626
46
init.org
46
init.org
@ -1479,8 +1479,14 @@
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
(use-package eglot
|
||||
:defer t
|
||||
:hook (eglot-managed-mode . (lambda () (eglot-inlay-hints-mode -1)))
|
||||
:config
|
||||
(setq eglot-events-buffer-size 0)
|
||||
(add-hook 'eglot-managed-mode-hook (lambda () (eglot-inlay-hints-mode -1)))
|
||||
(add-to-list 'eglot-server-programs
|
||||
'(web-mode . ("svelteserver" "--stdio"))))
|
||||
|
||||
|
||||
#+end_src
|
||||
|
||||
@ -1882,26 +1888,31 @@
|
||||
|
||||
** Webdev
|
||||
|
||||
My webdev setup isn't much, but with eglot, I don't find myself missing
|
||||
much. It depends on [[https://tree-sitter.github.io/tree-sitter/][Tree-sitter]], which was added in [[https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-29#n36][emacs 29.1]].
|
||||
|
||||
The following is what I use for plain Javascript:
|
||||
My webdev setup isn't much, but with eglot and Tree-sitter, I don't find
|
||||
myself missing much. It depends on [[https://tree-sitter.github.io/tree-sitter/][Tree-sitter]], which was added in [[https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-29#n36][emacs
|
||||
29.1]].
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js-ts-mode))
|
||||
(add-hook 'js-ts-mode-hook 'eglot-ensure)
|
||||
;; Major mode for editing JavaScript
|
||||
(use-package js-ts-mode
|
||||
:ensure nil
|
||||
:defer t
|
||||
:mode "\\.jsx?\\'"
|
||||
:hook (js-ts-mode . eglot-ensure))
|
||||
|
||||
#+end_src
|
||||
|
||||
Similarly for Typescript:
|
||||
Similarly for TypeScript.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.tsx?\\'" . tsx-ts-mode))
|
||||
(add-hook 'tsx-ts-mode-hook 'eglot-ensure)
|
||||
(setq typescript-ts-mode-indent-offset 4)
|
||||
|
||||
;; tree sitter support for TypeScript
|
||||
(use-package tsx-ts-mode
|
||||
:ensure nil
|
||||
:defer t
|
||||
:mode "\\.tsx?\\'"
|
||||
:hook (tsx-ts-mode . eglot-ensure))
|
||||
#+end_src
|
||||
|
||||
I am using [[https://svelte.dev][Svelte]] for some projects, where I find [[https://web-mode.org][web-mode]] along with the
|
||||
@ -1909,13 +1920,12 @@
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.svelte\\'" . web-mode))
|
||||
(add-hook 'web-mode-hook 'eglot-ensure)
|
||||
(with-eval-after-load "web-mode"
|
||||
(use-package web-mode
|
||||
:defer t
|
||||
:mode "\\.svelte\\'"
|
||||
:hook (web-mode . eglot-ensure)
|
||||
:config
|
||||
(add-to-list 'web-mode-engines-alist '("svelte" . "\\.svelte\\'")))
|
||||
(with-eval-after-load "eglot"
|
||||
(add-to-list 'eglot-server-programs
|
||||
'(web-mode . ("svelteserver" "--stdio"))))
|
||||
|
||||
#+end_src
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user