Beispiel #1
0
    def css_property_values(self, view, prefix, pos):
        prefix = css_prefixer(view, pos)
        prop   = find_css_property(view, pos)
        # These `values` are sourced from all the fully specified zen abbrevs
        # `d:n` => `display:none` so `display:n{tab}` will yield `none`
        values = css_property_values.get(prop)

        if values and prefix and prefix in values:
            oq_debug("zcprop:val prop: %r values: %r" % (prop, values))
            return [(prefix, v, v) for d,v in sorted(values.items())]
        else:
            # Look for values relating to that property
            # Remove exact matches, so a \t is inserted
            values =  [v for v in CSS_PROP_VALUES.get(prop, []) if v != prefix]
            if values:
                debug("zenmeta:val prop: %r values: %r" % (prop, values))
                return [(prefix, ':' + v, v) for v in values]
Beispiel #2
0
    def css_property_values(self, view, prefix, pos):
        prefix = css_prefixer(view, pos)
        prop   = find_css_property(view, pos)
        # These `values` are sourced from all the fully specified zen abbrevs
        # `d:n` => `display:none` so `display:n{tab}` will yield `none`
        values = css_property_values.get(prop)

        if values and prefix and prefix in values:
            oq_debug("zcprop:val prop: %r values: %r" % (prop, values))
            return [(prefix, v, v) for d,v in sorted(values.items())]
        else:
            # Look for values relating to that property
            # Remove exact matches, so a \t is inserted
            values =  [v for v in CSS_PROP_VALUES.get(prop, []) if v != prefix]
            if values:
                debug("zenmeta:val prop: %r values: %r" % (prop, values))
                return [(prefix, ':' + v, v) for v in values]
Beispiel #3
0
    def run(self, prop_value=False):
        window = self.window
        view = window.active_view()

        if prop_value:
            pos = view.sel()[0].b
            prop = find_css_property(window.active_view(), pos)
            forpanel = sorted((css_property_values.get(prop) or {}).items())
            contents = lambda i: forpanel[i][1]
            # TODO expand while selector matches
            "meta.property-value.css - punctuation"
            # Then insert snippet over top of selection
        else:
            forpanel = css_sorted
            contents = lambda i: expand_abbr(forpanel[i][0])

        def done(i):
            if i != -1:
                view.run_command('insert_snippet', {'contents': contents(i)})

        display = [[v, k] for k, v in forpanel]
        window.show_quick_panel(display, done)
    def run(self, prop_value=False):
        window = self.window
        view = window.active_view()

        if prop_value:
            pos      = view.sel()[0].b
            prop     = find_css_property(window.active_view(), pos)
            forpanel = sorted((css_property_values.get(prop) or {}).items())
            contents = lambda i: forpanel[i][1]
            # TODO expand while selector matches
            "meta.property-value.css - punctuation"
            # Then insert snippet over top of selection
        else:
            forpanel = css_sorted
            contents = lambda i: expand_abbr(forpanel[i][0])

        def done(i):
            if i != -1:
                view.run_command('insert_snippet', {'contents': contents(i)})

        display  = [[v,k] for k,v in forpanel]
        window.show_quick_panel(display, done)