X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/03387e61380f0c2f83e9c5d170c529b32abdaee0..dc4927b3509ae37ceec3993bacd28b7b7cfa19b3:/company-css.el diff --git a/company-css.el b/company-css.el index ec4865390..cf8c683ce 100644 --- a/company-css.el +++ b/company-css.el @@ -1,4 +1,4 @@ -;;; company-css.el --- company-mode completion back-end for css-mode -*- lexical-binding: t -*- +;;; company-css.el --- company-mode completion backend for css-mode -*- lexical-binding: t -*- ;; Copyright (C) 2009, 2011, 2014 Free Software Foundation, Inc. @@ -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" @@ -411,11 +413,13 @@ Returns \"\" if no property found, but feasible at this position." ;;;###autoload (defun company-css (command &optional arg &rest ignored) - "`company-mode' completion back-end for `css-mode'." + "`company-mode' completion backend for `css-mode'." (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)