From c92ad6a75a20fe7e820268f2983523e7f69658ae Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 15 May 2021 03:17:17 +0300 Subject: [PATCH] Include colons in the completion strings * lisp/textmodes/css-mode.el (css--complete-pseudo-element-or-class): Include colons in the completion strings. That's simply the nicer behavior (e.g. someone typing : will see pseudo-elements in completions as well), and by the standards, the colons are part of their names anyway (of pseudo-elements and classes). --- lisp/textmodes/css-mode.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 879c24a2fe1..61a2f6b3bc0 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1307,11 +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) - :company-kind (lambda (_) 'function)))))) + (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." -- 2.39.5