Home Download Buy Blog Forum Support

HTML attribute completions

HTML attribute completions

Postby agibsonsw on Fri Mar 23, 2012 10:19 pm

I can modify the HTML 'on_query_completions' behaviour so that I will be able to provide a completions list of attributes - appropriate to the current tag, with code such as the following.

Code: Select all
        if not view.match_selector(locations[0],
                "text.html - source"):
            return []

        pt = locations[0] - len(prefix) - 1
        ch = view.substr(sublime.Region(pt, pt + 1))
        if ch != '<':
         print view.scope_name(pt + 1)
         if not view.match_selector(locations[0],
                "text.html.basic meta.tag.inline.any.html"):
            print 'not found'
            return []
         return ([("helloAttr\tAttributes", "attr=\"$1\"")],
            sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)

But there is a default list of items that appear in the completions list - such as accesskey, bgcolor, etc. (screenshot). These seem to be built-in to ST. Is it possible to remove or suppress them? I realise that 'accesskey' is appropriate, but most of the others aren't. Actually, perhaps they are from ZenCoding(?).

Andy.
Attachments
html_compl1.png
html_compl1.png (11.14 KiB) Viewed 290 times
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 28 guests