Improve smartparens support for (* *) comment blocks
In tuareg-mode and fsharp-mode
This commit is contained in:
parent
92dd66f736
commit
d748fe0cd2
1 changed files with 19 additions and 8 deletions
|
@ -98,18 +98,19 @@
|
|||
;; characters), so just do it ourselves.
|
||||
(define-key! c++-mode-map "<" nil ">" nil)
|
||||
;; ...and leave it to smartparens
|
||||
(sp-with-modes '(c++-mode objc-mode)
|
||||
(sp-local-pair "<" ">"
|
||||
:when '(+cc-sp-point-is-template-p +cc-sp-point-after-include-p)
|
||||
:post-handlers '(("| " "SPC"))))
|
||||
(sp-local-pair '(c++-mode objc-mode)
|
||||
"<" ">"
|
||||
:when '(+cc-sp-point-is-template-p +cc-sp-point-after-include-p)
|
||||
:post-handlers '(("| " "SPC")))
|
||||
|
||||
(sp-with-modes '(c-mode c++-mode objc-mode java-mode)
|
||||
(sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC")))))
|
||||
(sp-local-pair '(c-mode c++-mode objc-mode java-mode)
|
||||
"/*!" "*/"
|
||||
:post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))
|
||||
|
||||
;; Expand C-style doc comment blocks. Must be done manually because some of
|
||||
;; these languages use specialized (and deferred) parsers, whose state we
|
||||
;; can't access while smartparens is doing its thing.
|
||||
(defun +default-expand-doc-comment-block (&rest _ignored)
|
||||
(defun +default-expand-asterix-doc-comment-block (&rest _ignored)
|
||||
(let ((indent (current-indentation)))
|
||||
(newline-and-indent)
|
||||
(save-excursion
|
||||
|
@ -122,7 +123,17 @@
|
|||
stylus-mode scala-mode)
|
||||
"/*" "*/"
|
||||
:actions '(insert)
|
||||
:post-handlers '(("| " "SPC") ("|\n*/[i][d-2]" "RET") (+default-expand-doc-comment-block "*")))
|
||||
:post-handlers '(("| " "SPC")
|
||||
("|\n*/[i][d-2]" "RET")
|
||||
(+default-expand-asterix-doc-comment-block "*")))
|
||||
|
||||
(after! smartparens-ml
|
||||
(sp-with-modes '(tuareg-mode fsharp-mode)
|
||||
(sp-local-pair "(*" "*)" :actions nil)
|
||||
(sp-local-pair "(*" "*"
|
||||
:actions '(insert)
|
||||
:post-handlers '(("| " "SPC") ("|\n[i]*)[d-2]" "RET")))))
|
||||
|
||||
|
||||
;; Highjacks backspace to:
|
||||
;; a) balance spaces inside brackets/parentheses ( | ) -> (|)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue