]> git.eshelyaron.com Git - emacs.git/commitdiff
Include colons in the completion strings
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 15 May 2021 00:17:17 +0000 (03:17 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 15 May 2021 00:28:39 +0000 (03:28 +0300)
* 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

index 879c24a2fe159d1eef7000d6c87e23f057a2f2d6..61a2f6b3bc0317a432594a8122a19bb1b3b21979 100644 (file)
@@ -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."