summaryrefslogtreecommitdiff
path: root/lisp/textmodes/css-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes/css-mode.el')
-rw-r--r--lisp/textmodes/css-mode.el22
1 files changed, 15 insertions, 7 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 622853da456..61a2f6b3bc0 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -427,7 +427,7 @@
"paged-y" "paged-x-controls" "paged-y-controls" "fragments")
;; CSS Text Decoration Module Level 3
- ;; (http://dev.w3.org/csswg/css-text-decor-3/#property-index)
+ ;; (https://dev.w3.org/csswg/css-text-decor-3/#property-index)
("text-decoration" text-decoration-line text-decoration-style
text-decoration-color)
("text-decoration-color" color)
@@ -1307,10 +1307,14 @@ for determining whether point is within a selector."
(let ((pos (point)))
(skip-chars-backward "-[:alnum:]")
(when (eq (char-before) ?\:)
- (list (point) pos
- (if (eq (char-before (- (point) 1)) ?\:)
- css-pseudo-element-ids
- css-pseudo-class-ids))))))
+ (let ((double-colon (eq (char-before (- (point) 1)) ?\:)))
+ (list (- (point) (if double-colon 2 1))
+ pos
+ (nconc
+ (unless double-colon
+ (mapcar (lambda (id) (concat ":" id)) css-pseudo-class-ids))
+ (mapcar (lambda (id) (concat "::" id)) css-pseudo-element-ids))
+ :company-kind (lambda (_) 'function)))))))
(defun css--complete-at-rule ()
"Complete at-rule (statement beginning with `@') at point."
@@ -1318,7 +1322,8 @@ for determining whether point is within a selector."
(let ((pos (point)))
(skip-chars-backward "-[:alnum:]")
(when (eq (char-before) ?\@)
- (list (point) pos css--at-ids)))))
+ (list (point) pos css--at-ids
+ :company-kind (lambda (_) 'keyword))))))
(defvar css--property-value-cache
(make-hash-table :test 'equal :size (length css-property-alist))
@@ -1366,7 +1371,8 @@ the string PROPERTY."
(skip-chars-backward "[:graph:]")
(list (point) end
(append '("inherit" "initial" "unset")
- (css--property-values (car property)))))))))
+ (css--property-values (car property)))
+ :company-kind (lambda (_) 'value)))))))
(defvar css--html-tags (mapcar #'car html-tag-alist)
"List of HTML tags.
@@ -1435,6 +1441,8 @@ tags, classes and IDs."
(list prop-beg prop-end)
(list sel-beg sel-end))
,(completion-table-merge prop-table sel-table)
+ :company-kind
+ ,(lambda (s) (if (test-completion s prop-table) 'property 'keyword))
:exit-function
,(lambda (string status)
(and (eq status 'finished)