Bug 142844 - Web Inspector: Improve Autocomplete in the Console
Summary: Web Inspector: Improve Autocomplete in the Console
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-03-18 14:59 PDT by Nikita Vasilyev
Modified: 2016-12-13 15:33 PST (History)
5 users (show)

See Also:


Attachments
Animated GIF of the current behavior (77.29 KB, image/gif)
2015-03-18 14:59 PDT, Nikita Vasilyev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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>