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.
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
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.
<rdar://problem/28229339>