summaryrefslogtreecommitdiff
path: root/lisp/progmodes/c-ts-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/c-ts-mode.el')
-rw-r--r--lisp/progmodes/c-ts-mode.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index f8e809bb43f..43668a56d96 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -84,8 +84,8 @@ MODE is either `c' or `cpp'."
((node-is "else") parent-bol 0)
((node-is "case") parent-bol 0)
((node-is "preproc_arg") no-indent)
- ((node-is "comment") no-indent)
- ((parent-is "comment") no-indent)
+ ((and (parent-is "comment") comment-end) comment-start -1)
+ ((parent-is "comment") comment-start-skip 0)
((node-is "labeled_statement") parent-bol 0)
((parent-is "labeled_statement") parent-bol c-ts-mode-indent-offset)
((match "preproc_ifdef" "compound_statement") point-min 0)
@@ -503,6 +503,8 @@ the subtrees."
(setq-local comment-start "/* ")
(setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
(setq-local comment-end " */")
+ (setq-local treesit-comment-start (rx "/" (or (+ "/") (+ "*"))))
+ (setq-local treesit-comment-end (rx (+ (or "*")) "/"))
(setq-local treesit-simple-indent-rules
(c-ts-mode--set-indent-style 'c))