This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 267736

Summary: No code completion for previously defined named functions
Product: web Reporter: markiewb
Component: KnockoutAssignee: Petr Hejl <phejl>
Status: NEW ---    
Severity: normal CC: ppisl
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: Screencast

Description markiewb 2016-08-28 12:27:11 UTC
Created attachment 161792 [details]
Screencast

define(['knockout'], function (ko) {
    return function (defaultValue) {
        this.username = ko.observable(defaultValue);
        this.greeting = ko.pureComputed(function () {
            return 'Hello' + this.username().toUpperCase();
        }, this);
        this.isAdmin = ko.pureComputed(function () {
            return this.| === "Admin"; // Code complete at |
        }, this);
    };
});

ACTUAL:
nothing is proposed
EXPECTED:
username() and greeting() should be proposed

NB8.1
Comment 1 markiewb 2016-08-28 12:31:47 UTC
I found out the reason.

The outer function must be named. See THISWASMISSING in the sample

define(['knockout'], function (ko) {
    return function THISWASMISSING(defaultValue) {
        this.username = ko.observable(defaultValue);
        this.greeting = ko.pureComputed(function () {
            return 'Hello' + this.username().toUpperCase();
        }, this);
        this.isAdmin = ko.pureComputed(function () {
            return this.| === "Admin"; // Code complete at |
        }, this);
    };
});