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
|
#+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)
|
(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
|
#+end_src
|
||||||
|
|
||||||
@ -1882,26 +1888,31 @@
|
|||||||
|
|
||||||
** Webdev
|
** Webdev
|
||||||
|
|
||||||
My webdev setup isn't much, but with eglot, I don't find myself missing
|
My webdev setup isn't much, but with eglot and Tree-sitter, I don't find
|
||||||
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]].
|
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:
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js-ts-mode))
|
;; Major mode for editing JavaScript
|
||||||
(add-hook 'js-ts-mode-hook 'eglot-ensure)
|
(use-package js-ts-mode
|
||||||
|
:ensure nil
|
||||||
|
:defer t
|
||||||
|
:mode "\\.jsx?\\'"
|
||||||
|
:hook (js-ts-mode . eglot-ensure))
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Similarly for Typescript:
|
Similarly for TypeScript.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.tsx?\\'" . tsx-ts-mode))
|
;; tree sitter support for TypeScript
|
||||||
(add-hook 'tsx-ts-mode-hook 'eglot-ensure)
|
(use-package tsx-ts-mode
|
||||||
(setq typescript-ts-mode-indent-offset 4)
|
:ensure nil
|
||||||
|
:defer t
|
||||||
|
:mode "\\.tsx?\\'"
|
||||||
|
:hook (tsx-ts-mode . eglot-ensure))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
I am using [[https://svelte.dev][Svelte]] for some projects, where I find [[https://web-mode.org][web-mode]] along with the
|
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
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
(add-to-list 'auto-mode-alist '("\\.svelte\\'" . web-mode))
|
(use-package web-mode
|
||||||
(add-hook 'web-mode-hook 'eglot-ensure)
|
:defer t
|
||||||
(with-eval-after-load "web-mode"
|
:mode "\\.svelte\\'"
|
||||||
|
:hook (web-mode . eglot-ensure)
|
||||||
|
:config
|
||||||
(add-to-list 'web-mode-engines-alist '("svelte" . "\\.svelte\\'")))
|
(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
|
#+end_src
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user