Commit fe578ae4 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/textmodes/css-mode.el (css-completion-at-point): Auto-insert

": ;" after completing a property.
parent 0e355e78
......@@ -696,7 +696,8 @@ cannot be completed sensibly: `custom-ident',
;; Even though pseudo-elements should be prefixed by ::, a
;; single colon is accepted for backward compatibility.
"\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids
css-pseudo-element-ids) t)
css-pseudo-element-ids)
t)
"\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)"
"\\(?:([^)]+)\\)?"
(if (not sassy)
......@@ -965,10 +966,22 @@ pseudo-elements, pseudo-classes, at-rules, and bang-rules."
(seq-let (prop-beg prop-end prop-table) (css--complete-property)
(seq-let (sel-beg sel-end sel-table) (css--complete-selector)
(when (or prop-table sel-table)
;; FIXME: If both prop-table and sel-table are set but
;; prop-beg/prop-end is different from sel-beg/sel-end
;; we have a problem!
`(,@(if prop-table
(list prop-beg prop-end)
(list sel-beg sel-end))
,(completion-table-merge prop-table sel-table)))))))
,(completion-table-merge prop-table sel-table)
:exit-function
,(lambda (string status)
(and (eq status 'finished)
prop-table
(test-completion string prop-table)
(not (and sel-table
(test-completion string sel-table)))
(progn (insert ": ;")
(forward-char -1))))))))))
;;;###autoload
(define-derived-mode css-mode prog-mode "CSS"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment