--- Begin Message ---
Subject: |
[PATCH] Support completion of attribute values in CSS mode |
Date: |
Sun, 06 Mar 2016 14:53:52 +0100 |
Hello!
I've finally gotten around to implement property value completion in
CSS mode. I've been using the attached patch privately for some weeks
now, and it seems to me that it works well.
The code has taken much inspiration from company-css.el, but there are
some differences:
- Completion lists for many new properties have been added, and a few
have been removed (most of them from the obsoleted marquee
module [1]).
- I've manually updated all completion lists according to the CSS spec
and fixed some bugs in the existing lists along the way. In general
I've tried to stay as close as possible to the grammar described in
the CSS spec wrt. names and order of the values and classes.
- The new `css--property-values' function is very similar to
`company-css-property-values', but it has been updated to support
following completion candidates further from the value class
completion lists.
- Completion a function name will no longer put commas between the
parenthesis. My reason for this is that many CSS functions take a
variable number of arguments. For instance, the `translate' function
is completed by company-css to `translate(,)', but `translate' can
take only one argument too, so the completion is misleading. Also,
there are functions that support an arbitrary number of
arguments. Instead of trying to support this, I've made every
function name complete to just `function()'. I think having ElDoc
support for CSS functions would be good for making it easier to
remember which arguments functions take.
- `inherit' has been added as a completion candidate for every
property.
Please have a look at the patch and tell me what you think!
-- Simen
0001-Support-completion-of-attribute-values-in-CSS-mode.patch
Description: Text Data
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#22923: [PATCH] Support completion of attribute values in CSS mode |
Date: |
Wed, 23 Mar 2016 19:17:56 +0100 |
On Mon, Mar 21, 2016 at 12:02 PM, Dmitry Gutov <address@hidden> wrote:
You're right, it's a bug. I'd fix that with only making company-css-value-classes recursive (but not refer back to company-css-property-alist there).
To put it differently, I don't like that there's conflation of property values and property names: if there appears a value sometimes that is the same as some property's name (unlikely, I know), it would be hard to represent in the proposed structure.
Anyway, I've taken more than enough of your time. Please go ahead with whichever version you prefer.
Don't worry Dmitry, I very much appreciate your through reviews.
You are right that there are some cases where property names and value
class names are the same (there are currently four), and I found a bug
in my handling of one of those. I remedied that by going with your
suggestion of making value classes symbols again, and only referring to
other value classes from those.
For properties, I made them also refer to value classes by default, but
made it possible to refer back to other properties in the cases where
the reference isn't found in the value class alist.
I attempted to document this thoroughly in the code and added some tests
that should cover the tricky cases.
I've installed the patch with the changes mentioned above.
Thanks again!
-- Simen
--- End Message ---