"Identifiers for pseudo-elements.")
(defconst css-at-ids
- '("charset" "font-face" "import" "media" "namespace" "page")
+ '("charset" "font-face" "import" "keyframes" "media" "namespace"
+ "page")
"Identifiers that appear in the form @foo.")
+(defconst scss-at-ids
+ '("at-root" "content" "debug" "each" "else" "else if" "error" "extend"
+ "for" "function" "if" "import" "include" "mixin" "return" "warn"
+ "while")
+ "Additional identifiers that appear in the form @foo in SCSS.")
+
+(defvar css--at-ids css-at-ids
+ "List of at-rules for the current mode.")
+(make-variable-buffer-local 'css--at-ids)
+
(defconst css-bang-ids
'("important")
"Identifiers that appear in the form !foo.")
(let ((pos (point)))
(skip-chars-backward "-[:alnum:]")
(when (eq (char-before) ?\@)
- (list (point) pos css-at-ids)))))
+ (list (point) pos css--at-ids)))))
(defvar css--property-value-cache
(make-hash-table :test 'equal :size (length css-property-alist))
Completion candidates are looked up in `css-property-alist' by
the string PROPERTY."
(or (gethash property css--property-value-cache)
- (seq-mapcat
- (lambda (value)
- (if (stringp value)
- (list value)
- (or (css--value-class-lookup value)
- (css--property-values (symbol-name value)))))
- (cdr (assoc property css-property-alist)))))
+ (let ((values
+ (seq-uniq
+ (seq-mapcat
+ (lambda (value)
+ (if (stringp value)
+ (list value)
+ (or (css--value-class-lookup value)
+ (css--property-values (symbol-name value)))))
+ (cdr (assoc property css-property-alist))))))
+ (puthash property values css--property-value-cache))))
(defun css--complete-property-value ()
"Complete property value at point."
(setq-local comment-continue " *")
(setq-local comment-start-skip "/[*/]+[ \t]*")
(setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)")
+ (setq-local css--at-ids (append css-at-ids scss-at-ids))
(setq-local css--bang-ids (append css-bang-ids scss-bang-ids))
(setq-local font-lock-defaults
(list (scss-font-lock-keywords) nil t)))