Set up web dev environment

This commit is contained in:
jdormit 2024-10-22 12:50:56 -04:00
parent 6448c9f70e
commit 7fb508a2d0
5 changed files with 21 additions and 9 deletions

View File

@ -73,6 +73,8 @@
(add-hook 'eglot-managed-mode-hook #'my-eglot-managed-hook) (add-hook 'eglot-managed-mode-hook #'my-eglot-managed-hook)
(add-to-list 'eglot-server-programs (add-to-list 'eglot-server-programs
'(js-web-mode . ("typescript-language-server" "--stdio"))) '(js-web-mode . ("typescript-language-server" "--stdio")))
(add-to-list 'eglot-server-programs
'(ts-web-mode . ("typescript-language-server" "--stdio")))
(add-to-list 'eglot-server-programs (add-to-list 'eglot-server-programs
`(html-web-mode . ,(eglot-alternatives `(html-web-mode . ,(eglot-alternatives
'(("vscode-html-language-server" "--stdio") '(("vscode-html-language-server" "--stdio")
@ -227,7 +229,7 @@
(typescript-mode . eglot-ensure) (typescript-mode . eglot-ensure)
(python-mode . eglot-ensure) (python-mode . eglot-ensure)
(js-web-mode . eglot-ensure) (js-web-mode . eglot-ensure)
(tsx-ts-mode . eglot-ensure) (ts-web-mode . eglot-ensure)
(html-web-mode . eglot-ensure) (html-web-mode . eglot-ensure)
(scala-mode . eglot-ensure) (scala-mode . eglot-ensure)
(c-mode . eglot-ensure) (c-mode . eglot-ensure)

View File

@ -33,10 +33,4 @@
"C-c C-k" #'js-send-buffer "C-c C-k" #'js-send-buffer
"C-c M-z" #'js-send-buffer-and-go)) "C-c M-z" #'js-send-buffer-and-go))
(use-package typescript-mode
:mode ("\\.ts\\'"
"\\.mjs\\'")
:custom
(typescript-indent-level 2))
(provide 'init-js) (provide 'init-js)

View File

@ -494,6 +494,17 @@
:working-dir project :working-dir project
:runner 'run-command-runner-vterm)))))))) :runner 'run-command-runner-vterm))))))))
(defun run-command-recipe-docker-compose ()
(when-let ((compose-dir (locate-dominating-file default-directory "compose.yaml")))
(list
(list :command-name "up"
:command-line "docker compose up"
:working-dir compose-dir)
(list :command-name "up --watch"
:command-line "docker compose up --watch"
:working-dir compose-dir
:runner 'run-command-runner-vterm))))
:general :general
(leader-map "'" #'run-command) (leader-map "'" #'run-command)
(leader-map "\"" #'run-command-with-runner) (leader-map "\"" #'run-command-with-runner)
@ -519,6 +530,7 @@
run-command-recipe-rake run-command-recipe-rake
run-command-recipe-scripts run-command-recipe-scripts
run-command-recipe-rspec run-command-recipe-rspec
run-command-recipe-hummingbird))) run-command-recipe-hummingbird
run-command-recipe-docker-compose)))
(provide 'init-run-command) (provide 'init-run-command)

View File

@ -24,6 +24,11 @@
"Web mode in JS files.") "Web mode in JS files.")
(add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js-web-mode)) (add-to-list 'auto-mode-alist '("\\.jsx?\\'" . js-web-mode))
(define-derived-mode ts-web-mode web-mode "TS Web Mode"
"Web mode in TypeScript files.")
(add-to-list 'auto-mode-alist '("\\.tsx?\\'" . ts-web-mode))
(define-derived-mode html-web-mode web-mode "HTML Web Mode" (define-derived-mode html-web-mode web-mode "HTML Web Mode"
"Web mode in HTML files.") "Web mode in HTML files.")
(add-to-list 'auto-mode-alist '("\\.html?\\'" . html-web-mode)) (add-to-list 'auto-mode-alist '("\\.html?\\'" . html-web-mode))

View File

@ -7,7 +7,6 @@
(add-hook 'yaml-ts-mode-hook #'highlight-indent-guides-mode)) (add-hook 'yaml-ts-mode-hook #'highlight-indent-guides-mode))
(use-package yaml-pro (use-package yaml-pro
:when (treesit-ready-p 'yaml)
:hook (yaml-ts-mode . yaml-pro-ts-mode) :hook (yaml-ts-mode . yaml-pro-ts-mode)
:config :config
(defun yaml-pro-edit-initialize-buffer-filter-args-advice (args) (defun yaml-pro-edit-initialize-buffer-filter-args-advice (args)