From 7fb508a2d0cc3a2db1ac76663499fd35c4d16c9b Mon Sep 17 00:00:00 2001 From: jdormit Date: Tue, 22 Oct 2024 12:50:56 -0400 Subject: [PATCH] Set up web dev environment --- emacs/.emacs.d/config/init-ide.el | 4 +++- emacs/.emacs.d/config/init-js.el | 6 ------ emacs/.emacs.d/config/init-run-command.el | 14 +++++++++++++- emacs/.emacs.d/config/init-web.el | 5 +++++ emacs/.emacs.d/config/init-yaml.el | 1 - 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/emacs/.emacs.d/config/init-ide.el b/emacs/.emacs.d/config/init-ide.el index 487a64f..a617cb1 100644 --- a/emacs/.emacs.d/config/init-ide.el +++ b/emacs/.emacs.d/config/init-ide.el @@ -73,6 +73,8 @@ (add-hook 'eglot-managed-mode-hook #'my-eglot-managed-hook) (add-to-list 'eglot-server-programs '(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 `(html-web-mode . ,(eglot-alternatives '(("vscode-html-language-server" "--stdio") @@ -227,7 +229,7 @@ (typescript-mode . eglot-ensure) (python-mode . eglot-ensure) (js-web-mode . eglot-ensure) - (tsx-ts-mode . eglot-ensure) + (ts-web-mode . eglot-ensure) (html-web-mode . eglot-ensure) (scala-mode . eglot-ensure) (c-mode . eglot-ensure) diff --git a/emacs/.emacs.d/config/init-js.el b/emacs/.emacs.d/config/init-js.el index c0c9d83..040c3fc 100644 --- a/emacs/.emacs.d/config/init-js.el +++ b/emacs/.emacs.d/config/init-js.el @@ -33,10 +33,4 @@ "C-c C-k" #'js-send-buffer "C-c M-z" #'js-send-buffer-and-go)) -(use-package typescript-mode - :mode ("\\.ts\\'" - "\\.mjs\\'") - :custom - (typescript-indent-level 2)) - (provide 'init-js) diff --git a/emacs/.emacs.d/config/init-run-command.el b/emacs/.emacs.d/config/init-run-command.el index b5f36a2..a549ad2 100644 --- a/emacs/.emacs.d/config/init-run-command.el +++ b/emacs/.emacs.d/config/init-run-command.el @@ -494,6 +494,17 @@ :working-dir project :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 (leader-map "'" #'run-command) (leader-map "\"" #'run-command-with-runner) @@ -519,6 +530,7 @@ run-command-recipe-rake run-command-recipe-scripts run-command-recipe-rspec - run-command-recipe-hummingbird))) + run-command-recipe-hummingbird + run-command-recipe-docker-compose))) (provide 'init-run-command) diff --git a/emacs/.emacs.d/config/init-web.el b/emacs/.emacs.d/config/init-web.el index afbcc9f..b291414 100644 --- a/emacs/.emacs.d/config/init-web.el +++ b/emacs/.emacs.d/config/init-web.el @@ -24,6 +24,11 @@ "Web mode in JS files.") (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" "Web mode in HTML files.") (add-to-list 'auto-mode-alist '("\\.html?\\'" . html-web-mode)) diff --git a/emacs/.emacs.d/config/init-yaml.el b/emacs/.emacs.d/config/init-yaml.el index 3c5b667..1bf45d6 100644 --- a/emacs/.emacs.d/config/init-yaml.el +++ b/emacs/.emacs.d/config/init-yaml.el @@ -7,7 +7,6 @@ (add-hook 'yaml-ts-mode-hook #'highlight-indent-guides-mode)) (use-package yaml-pro - :when (treesit-ready-p 'yaml) :hook (yaml-ts-mode . yaml-pro-ts-mode) :config (defun yaml-pro-edit-initialize-buffer-filter-args-advice (args)