Files
.emacs.d/modules/languages/siren-js.el

50 lines
1.1 KiB
EmacsLisp

;;; siren-js.el --- jimeh's Emacs Siren: js-mode configuration.
;;; Commentary:
;; Basic configuration for js-mode.
;;; Code:
(require 'siren-lsp)
(use-package js-mode
:straight (:type built-in)
:mode
"\\.js\\'"
"\\.pac\\'"
:general
(:keymaps 'js-mode-map
"C-j" 'newline-and-indent)
:hook
(js-mode . siren-js-mode-setup)
:preface
(defun siren-js-mode-setup ()
"Default tweaks for `js-mode'."
(let ((width 2))
(setq-local js-indent-level width
indent-level width
tab-width width))))
(use-package lsp-javascript
:straight lsp-mode
:hook
(js-mode . siren-lsp-js-mode-setup)
:preface
(defun siren-lsp-js-mode-setup ()
;; Disable semantic tokens as it typically causes an annoying delay with the
;; syntax highlighting as you type. Essentially all new text is a very faded
;; out grey color for the first 1-2 seconds as you type.
(setq-local lsp-semantic-tokens-enable nil)
(lsp-deferred)
(lsp-format-buffer-on-save-mode)))
(provide 'siren-js)
;;; siren-js.el ends here