emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 728b1c7: Support completion of at-rules in SCSS mod


From: Simen Heggestøyl
Subject: [Emacs-diffs] master 728b1c7: Support completion of at-rules in SCSS mode
Date: Tue, 05 Apr 2016 21:16:47 +0000

branch: master
commit 728b1c7f139270bf0cbe93e33769d06b9903f20f
Author: Etienne Prud'homme <address@hidden>
Commit: Simen Heggestøyl <address@hidden>

    Support completion of at-rules in SCSS mode
    
    lisp/textmodes/css-mode.el (scss-at-ids): New defconst holding
    SCSS-specific at-rules.
    (css--at-ids): New buffer-local variable holding the list of at-rules
    for the current mode.
    (css--complete-at-rule): Retrieve at-rules from `css--at-ids`.
    (scss-mode): Set `css--at-ids'.
    
    Copyright-paperwork-exempt: yes
---
 lisp/textmodes/css-mode.el |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index cbef3d4..8f80b2c 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -56,6 +56,16 @@
   '("charset" "font-face" "import" "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.")
@@ -759,7 +769,7 @@ cannot be completed sensibly: `angle', `element-reference',
     (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))
@@ -969,6 +979,7 @@ pseudo-elements, pseudo-classes, at-rules, and bang-rules."
   (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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]