Bug 142844

Summary: Web Inspector: Improve Autocomplete in the Console
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: ASSIGNED ---    
Severity: Normal CC: graouts, hi, inspector-bugzilla-changes, jonowells, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Animated GIF of the current behavior none

Description Nikita Vasilyev 2015-03-18 14:59:11 PDT
Created attachment 248969 [details]
Animated GIF of the current behavior

Don’t autocomplete:

var a|
function a|
function myFunc(a|
class a|
{a|
{get a|

(Text cursor is marked by |)

The current behavior is demonstrated in the attached animated GIF.
Comment 1 Nikita Vasilyev 2015-03-18 16:27:59 PDT
http://trac.webkit.org/browser/trunk/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js#L579

CodeMirror provides lexical types which I was hoping to leverage.

Unfortunately, for both cases below the lexical type is the same "vardef":

    var a| <- shouldn’t autocomplete
    var a = myFunc| <- should autocomplete

Lexical type ")":

    function a(b| <- shouldn’t autocomplete
    if(myFunc| <- should autocomplete

Lexical type "stat":

    {a| <- shouldn’t autocomplete
    myFunc| <- shouldn’t autocomplete
Comment 2 Nikita Vasilyev 2015-03-18 17:59:33 PDT
Seems like the only case I can fix is:

    function a|

At this case CodeMirror’s lexical type is "block".

However,

    var fn = function a|

is lexical type "vardef" and

    function fn() {return function a|

is lexical type "stat". These two will still trigger pointless autocomplete.
Comment 3 David Kilzer (:ddkilzer) 2016-09-09 11:49:02 PDT
<rdar://problem/28229339>