any way to trick intellisense?

Let us know what you would like to see in the next version of this software

Moderator: kfury77

Forum rules
Please follow these guidelines when posting feature requests. This will help to increase the value of your contribution.
  • Do not create new topics for already requested features. Add your comments to the existing feature request topics instead;
  • Create separate topic for each feature suggestion. Do NOT post a number of non-related feature suggestions in a single topic;
  • Give your topic a meaningful title. Do NOT create topics with meaningless titles, such as "My Suggestion" or "My Problem".
Please note that we DO READ all suggestions, even if a reply is not posted. Thanks!
Post Reply
Samhayne
Posts: 4
Joined: Mon Oct 26, 2009 1:28 pm

any way to trick intellisense?

Post by Samhayne »


///////// **** MILK **** ///////////////

class Milk
{
public $moo;

public function Milk()
{
$this->moo = false;
}
}

///////// **** COFFEE **** ///////////////


class Coffee
{
public $mYummyumm;
public $mMilk;

public function Coffee()
{
$yummyumm = true;
$mMilk = new Milk();
}

public function getMilk()
{
return $this->mMilk;
}


}

//==================================



$myCoff = new Coffee();
$myCoff->->mMilk->... // <- intellisense win will pop up
$myCoff->getMilk()-> //<- no intellisense for mMilk there


Is there a way to make the "Intellisense" window pop up here?
Yeah... I know... Rapid PHP can't really know what getMilk() is returning as the return value can't be defined in the function.

I often help myself by doing something like this:

$bMilk = new Milk()
$bMilk = $myCoff->getMilk();

$bMilk->... //<- will have intellisense window now....


But this often leads to errors in some cases when forgetting to delete the "new" line afterwards.

Is there some less troublesome way?




By the way... is there any way to make the & vanish from intellisense added functions which return a reference?
Gatis
Blumentals Software Developer
Posts: 545
Joined: Sun Mar 05, 2006 12:30 am
Location: Latvia

Re: any way to trick intellisense?

Post by Gatis »

Is there some less troublesome way?
I am afraid there is no other way for now.
One solution I have thought about, is to specify the return value inside a function using a special comment. But this is only a thought.
To the date, I can not recall anybody else asking for this.
Cast your votes here, if you really need this ( I have moved the topic to Feature Requests)
By the way... is there any way to make the & vanish from intellisense added functions which return a reference?
You can not modify text returned by auto-complete. Do you mean there is a bug in current functionality?
If so, please give us an example.
Kind regards,
Gatis Avots
Samhayne
Posts: 4
Joined: Mon Oct 26, 2009 1:28 pm

Re: any way to trick intellisense?

Post by Samhayne »

Gatis wrote:
Is there some less troublesome way?
I am afraid there is no other way for now.
One solution I have thought about, is to specify the return value inside a function using a special comment. But this is only a thought.
To the date, I can not recall anybody else asking for this.
Cast your votes here, if you really need this ( I have moved the topic to Feature Requests)
Vote +1. :D (surprise!)
I'd love it. Really.
It would save so much time looking up members and methods and frickling around with fake "new"s.

edit: d'oh... better trick: if (false) $mMilk = new Milk; //Intellisense
This one can be kept in the code and will provide Intellisense if needed.
Gatis wrote:
By the way... is there any way to make the & vanish from intellisense added functions which return a reference?
You can not modify text returned by auto-complete. Do you mean there is a bug in current functionality?
If so, please give us an example.
Sure.

I modified the example above to return a reference.


Code: Select all

class milk
{
  public $mMoo;

  public function milk()
  {
    $this->mMoo = true;
  }
}

class coffee
{
  public $mYummyumm;
  public $mMilk;

  public function coffee()
  {
    $yummyumm = true;
    $this->mMilk = new milk();
  }

  public function &getMilk()
  {
    $milkRef =& $this->mMilk->mMoo;

    return $milkRef;
  }


}

Now when typing...


Image

Enter...

Image

run script...

Image
Post Reply