]> code.delx.au - gnu-emacs-elpa/commitdiff
company-css: Support web-mode
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 16 Jun 2015 11:38:58 +0000 (14:38 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 16 Jun 2015 11:39:40 +0000 (14:39 +0300)
Closes #363

company-css.el

index ec48653907d6257e119e0ea71ea62a330f7de1f4..28f6c2d04c112c98067a607a930d10b73e4f9909 100644 (file)
@@ -26,6 +26,8 @@
 (require 'company)
 (require 'cl-lib)
 
+(declare-function web-mode-language-at-pos "web-mode" (&optional pos))
+
 (defconst company-css-property-alist
   ;; see http://www.w3.org/TR/CSS21/propidx.html
   '(("azimuth" angle "left-side" "far-left" "left" "center-left" "center"
@@ -415,7 +417,9 @@ Returns \"\" if no property found, but feasible at this position."
   (interactive (list 'interactive))
   (cl-case command
     (interactive (company-begin-backend 'company-css))
-    (prefix (and (derived-mode-p 'css-mode)
+    (prefix (and (or (derived-mode-p 'css-mode)
+                     (and (derived-mode-p 'web-mode)
+                          (string= (web-mode-language-at-pos) "css")))
                  (or (company-grab company-css-tag-regexp 1)
                      (company-grab company-css-pseudo-regexp 1)
                      (company-grab company-css-property-value-regexp 2)