Fix /* and /** expansion in various languages

Also adds +web-continue-block-comments option to control:

/*
 *
 */

vs

/*

*/

Has a known issue where the indentation for the closing delimiter is off
by one when +web-continue-block-comments is disabled. Will have to look
into that later.
This commit is contained in:
Henrik Lissner
2020-11-08 20:00:22 -05:00
parent 92c9127b86
commit b96b6ed64e
3 changed files with 65 additions and 50 deletions

View File

@@ -1,13 +1,12 @@
;;; lang/web/+css.el -*- lexical-binding: t; -*-
;; An improved newline+continue comment function
(setq-hook! css-mode
comment-indent-function #'+css/comment-indent-new-line)
(defvar +web-continue-block-comments t
"If non-nil, newlines in block comments are continued with a leading *.
(after! (:any css-mode sass-mode)
(set-docsets! '(css-mode scss-mode sass-mode)
"CSS" "HTML" "Bourbon" "Compass"
["Sass" (memq major-mode '(scss-mode sass-mode))]))
This also indirectly means the asterisks in the opening /* and closing */ will
be aligned.
If set to `nil', disable all the above behaviors.")
(after! projectile
(pushnew! projectile-other-file-alist
@@ -21,6 +20,15 @@
;;
;;; Major modes
(setq-hook! 'css-mode-hook
;; Correctly continue /* and // comments on newline-and-indent
comment-line-break-function #'+css/comment-indent-new-line)
(after! (:any css-mode sass-mode)
(set-docsets! '(css-mode scss-mode sass-mode)
"CSS" "HTML" "Bourbon" "Compass"
["Sass" (memq major-mode '(scss-mode sass-mode))]))
(add-hook! '(css-mode-hook sass-mode-hook stylus-mode-hook)
#'rainbow-mode)