Пример #1
0
    def css_selectors(self, view, prefix, pos):
        elements = [(v, v) for v in sorted(HTML_ELEMENTS_ATTRIBUTES.keys())
                    if v != prefix]

        if view.syntax_name(pos).strip() in ('source.scss', 'source.css'):
            return elements
        else:
            selector = find_css_selector(view, pos)
            oq_debug('css_selectors selector: %r' % selector)

            if ':' in selector:
                prefix = selector.rsplit(':', 1)[-1]
                return [(prefix, (':' + p), p.replace('|', '$1'))
                        for p in CSS_PSEUDO_CLASSES
                        if not prefix or p.startswith(prefix[0].lower())]
            elif selector.startswith('.'):
                return []
                # return []
                return [(selector, v, v) for v in set(
                    map(view.substr, [
                        r for r in view.find_by_selector(
                            'source.css '
                            'meta.selector.css entity.other.attribute-name.class.css'
                        ) if not r.contains(pos)
                    ]))]
            else:
                return elements
Пример #2
0
    def css_selectors(self, view, prefix, pos):
        elements = [ (v, v) for v in
                     sorted(HTML_ELEMENTS_ATTRIBUTES.keys()) if v != prefix]

        if view.syntax_name(pos).strip() in ('source.scss', 'source.css'):
            return elements
        else:
            selector = find_css_selector(view, pos)
            oq_debug('css_selectors selector: %r' % selector)

            if ':' in selector:
                prefix = selector.rsplit(':', 1)[-1]
                return [ ( prefix, (':' + p), p.replace('|', '$1') ) for p in
                           CSS_PSEUDO_CLASSES if
                           not prefix or p.startswith(prefix[0].lower() ) ]
            elif selector.startswith('.'):
                return []
                # return []
                return [(selector, v, v) for v in
                     set(map(view.substr, [
                         r for r in view.find_by_selector('source.css '
                       'meta.selector.css entity.other.attribute-name.class.css')
                          if not r.contains(pos)] ))]
            else:
                return elements
Пример #3
0
    def css_selectors(self, view, prefix, pos):
        elements = [ (v, v) for v in
                     sorted(HTML_ELEMENTS_ATTRIBUTES.keys()) if v != prefix]

        if view.syntax_name(pos).strip() in ('source.scss', 'source.css'):
            return elements
        else:
            selector = find_css_selector(view, pos)
            oq_debug('css_selectors selector: %r' % selector)

            if ':' in selector:
                prefix = selector.rsplit(':', 1)[-1]
                return [ ( prefix, (':' + p), p.replace('|', '$1') ) for p in
                           CSS_PSEUDO_CLASSES if
                           not prefix or p.startswith(prefix[0].lower() ) ]
            else:
                return elements
Пример #4
0
    def css_selectors(self, view, prefix, pos):
        elements = [ (v, v) for v in
                     sorted(HTML_ELEMENTS_ATTRIBUTES.keys()) if v != prefix]

        if view.syntax_name(pos).strip() in ('source.scss', 'source.css'):
            return elements
        else:
            selector = find_css_selector(view, pos)
            oq_debug('css_selectors selector: %r' % selector)

            if ':' in selector:
                prefix = selector.rsplit(':', 1)[-1]
                return [ ( prefix, (':' + p), p.replace('|', '$1') ) for p in
                           CSS_PSEUDO_CLASSES if
                           not prefix or p.startswith(prefix[0].lower() ) ]
            else:
                return elements
Пример #5
0
    def css_selectors(self, view, prefix, pos):
        elements = [(v, v) for v in sorted(HTML_ELEMENTS_ATTRIBUTES.keys()) if v != prefix]

        if view.syntax_name(pos).strip() in ("source.scss", "source.css"):
            return elements
        else:
            selector = find_css_selector(view, pos)
            oq_debug("css_selectors selector: %r" % selector)

            if ":" in selector:
                prefix = selector.rsplit(":", 1)[-1]
                return [
                    (prefix, (":" + p), p.replace("|", "$1"))
                    for p in CSS_PSEUDO_CLASSES
                    if not prefix or p.startswith(prefix[0].lower())
                ]
            else:
                return elements
Пример #6
0
 def html_elements_attributes(self, view, prefix, pos):
     tag = find_tag_name(view, pos)
     values = HTML_ELEMENTS_ATTRIBUTES.get(tag, [])
     return [(v, '%s\t@%s' % (v, v), '%s="$1"' % v) for v in values]
Пример #7
0
 def html_elements_attributes(self, view, prefix, pos):
     tag         = find_tag_name(view, pos)
     values      = HTML_ELEMENTS_ATTRIBUTES.get(tag, [])
     return [(v,   '%s\t@%s' % (v,v), '%s="$1"' % v) for v in values]