Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot expand prototype #3387

Closed
alexdima opened this issue Feb 24, 2016 · 4 comments
Closed

Cannot expand prototype #3387

alexdima opened this issue Feb 24, 2016 · 4 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@alexdima
Copy link
Member

Testing #2941

prototype has a twisty so IMHO there should be some content under it

expand-prototype

function Safe(_key) {
    var _locked = true;
    var _value = null;

    this.unlock = function(key) {
        if (_key === key) {
            _locked = false;
        }
        return;
    };

    this.lock = function() {
        _locked = true;
    };

    Object.defineProperty(this, 'value', {
        get: function() {
            if (_locked) {
                console.log('thief detected!');
                process.exit(0);
            }
            return _value;
        },

        set: function(value) {
            if (_locked) {
                console.log('thief detected!');
                process.exit(0);
            }
            _value = value;
        }
    });
}

var safe = new Safe('mySecretPassword');

safe.unlock('mySecretPassword');
safe.value = 3;
console.log(safe.value);
safe.lock();
@isidorn isidorn added the debug Debug viewlet, configurations, breakpoints, adapter issues label Feb 24, 2016
@isidorn
Copy link
Contributor

isidorn commented Feb 24, 2016

The prototype has a twistie because it has reference > 0 as returned by the adapter. On the vscode side we expand it lazily which means we only request children once the user clicks expand.

So this might be a feature request that variables with no children should not have reference > 0
Moving to @weinand

@isidorn isidorn assigned weinand and unassigned isidorn Feb 24, 2016
@alexdima
Copy link
Member Author

Not sure I'd label this one as a feature request :), my end user impression is that there is a bug in the hover, in the tree, or in the debugger.

@weinand
Copy link
Contributor

weinand commented Feb 24, 2016

@alexandrudima for structured objects, we do not know whether it has properties without fetching them (the v8debugger protocol does not provide a mechanism for retrieving the number of properties independently from fetching them all). Fetching all properties all the time just to learn whether a twistie is required or not can be very expensive if the object is large (e.g. an array).

This strategy is consistent with the VS Code navigator: it shows a twistie for folders even if the folder is empty.

@weinand weinand closed this as completed Feb 24, 2016
@alexdima
Copy link
Member Author

You're correct, we do the same in the explorer, which I also find weird :). I guess I don't deal with empty folders often. Check this one out:

No twisties next to unexpandable folders (folders without subfolders)

image

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

3 participants