[Webkit-unassigned] [Bug 17374] Inspector should support tab completion while editing CSS

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 26 23:46:33 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=17374





--- Comment #11 from Joseph Pecoraro <joepeck at webkit.org>  2010-04-26 23:46:33 PST ---
(In reply to comment #10)
> I didn't do much. I was experimenting with two different types of autocomplete
> suggestions http://elv1s.ru/files/web-inspector/

Neat! Great work so far.


> Right now I'm trying to hook up autocomplete to Inspector with no luck. 
> WebInspector.StylePropertyTreeElement.prototype.editingKeyDown looks like the
> way to go. It even has note "// FIXME: this should cycle through known keywords
> for the current property name.". The problem is, it never fires for me while
> I'm editing CSS property.

Yes, I think you're in the right spot. Right now it doesn't reach that code
because it returns early. Right at the start of the function it breaks unless
the key was up/down/pageup/pagedown:

>    editingKeyDown: function(event)
>    {
>        var arrowKeyPressed = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down");
>        var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdentifier === "PageDown");
>        if (!arrowKeyPressed && !pageKeyPressed)
>            return;

If you want to do autocompletion on key down (like your demo) you will want to
call your own function here, or remove the break and handle things later. Or
you could add your own keyup listener.

Your demo is nice. It does a setTimeout on keydown so that when given function
runs it will have access to the complete text. I don't think there are any
problems with this approach, because of JavaScript's nature. The current
editKeyDown code uses ranges to find the current word the cursor is in. That
might be useful as well. You'll also want to know if you are before / after the
initial ":" meaning you're editing the property / value and so you'll need to
know more anyways.

Keep up the great work!

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list