[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master c92ad6a 2/2: Include colons in the completion strings
From: |
Dmitry Gutov |
Subject: |
master c92ad6a 2/2: Include colons in the completion strings |
Date: |
Fri, 14 May 2021 20:29:01 -0400 (EDT) |
branch: master
commit c92ad6a75a20fe7e820268f2983523e7f69658ae
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
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 879c24a..61a2f6b 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."