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 - No code completion for previously defined named functions
Summary: No code completion for previously defined named functions
Status: NEW
Alias: None
Product: web
Classification: Unclassified
Component: Knockout (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-28 12:27 UTC by markiewb
Modified: 2016-08-28 12:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screencast (33.50 KB, image/gif)
2016-08-28 12:27 UTC, markiewb
Details

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