Peekmo / atom-autocomplete-php

Autocomplete for PHP in atom editor
MIT License
136 stars 34 forks source link

Enhancement - Skip variables in the wrong scope. #146

Open ghost opened 9 years ago

ghost commented 9 years ago

Hello

In the further future, we should probably look at having getAllVariablesInFunction as well as getVariableType skip scopes that don't apply. For example:

$y = new Foo();

function foo()
{
    $x = 5;
    $y = new Bar();
    $z = 3;

    $callback = function () use ($z) {
        // $x and $y should not be visible here, $z should be visible.
    };
}

// I shouldn't see $x in autocompletion here as it is in another scope.
// $y should not resolve to an instance of Bar, but of Foo.

I think this is more of a low-priority ticket and something for the long-term roadmap.

Thanks in advance

Peekmo commented 9 years ago

Yes, in fact that's not a really common use case ^^ So very low priority