S
S
Sergei Iamskoi2014-12-25 12:57:33
PHP
Sergei Iamskoi, 2014-12-25 12:57:33

Why isn't NetBeans IDE autocomplete working?

Decided to try out the NetBeans IDE. So far, everyone likes it. But here I ran into a problem that it does not define all variables and uses autocompletion for them.
There is a config.php file:

<?php
// Автозагрузчик классов
require_once('./config/autoload.php');
$globaluser = new user(1);
?>

There is an index.php file:
<?php
require_once('./config.php');
$globaluser-> // Вот тут нет автозавершения. Т.е. объявленную ранее переменную в приинклуженом файле не видит.
$localuser = new user(1);
$localuser-> // Вот тут все схватывает. 
?>

What is the reason?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lesha Kiselev, 2014-12-25
@Yakud

Try PHPStorm

S
Sergei Iamskoi, 2014-12-25
@syamskoy

I'll answer the question myself. The truth is a crutch solution:

/* @var $globaluser user  */
$globaluser->...

In the comment, you must explicitly indicate in front of the variable what type it belongs to, then netbins works correctly. And how to make it automatically pick up - I did not find it.
As for other IDEs, I'll definitely try. And so all my life I sat on TotalCommander + EmEditor - I didn’t know anything more convenient :)

O
OnYourLips, 2014-12-25
@OnYourLips

The problem is in the code: it's low quality noodles.
How does the IDE need to know which file you include in which?
Therefore, there are two alternatives.
Or continue to shit-code and prescribe /** var */ for variables in files.
Or write good code that will not have global variables and variables with an external context.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question