NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Parameter hints for subsequent methods


Joined: 11 May 2008
Posts: 78
Reply with quote
Hello.
Phped 7023 (but holds true for previous builds too).

Parameters hint (the yellow bar for parameters when inside parentheses) disappear in the following scenario.
We have a class with few methods, let's say m1($a), m2($a), m3($a) declared in that order within the class. All of them are public (doesn't matter I think). All of them have phpdoc for desc and parameters.

Inside the method m2 I start writing: $this-> and it suggests the three methods as it should. I complete with m3 (or write it by hand) and after the opening parenthesis I see the parameters hint with $a and its description.
If I start with a quote or double quote for a string parameter, the hint disappears and if I try Ctrl+Shift+Space it throws an error stating something like Failed to find MyClass::m3()...
If I do the same but this time with m1 (which is declared up in the code) it works without a problem.
Thus, only when I try and start to pass string parameters, this happens, when dealing with methods declared later in the code.

Again, I'm posting here first to see if this is a bug or anyone else experiences this (in case I'm accused again to post in the wrong place).
View user's profileFind all posts by tedychSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
This is not a bug. The decistion whether particular part of code is a class method or not is made by parser which works according to php grammar rules. Althrough the grammar has rules to recover from syntax errors, it still requires to process some certain tokens until it gets recovered. If it happens before your m3 appears, the m3 will be properly recognized and code completion will be able to work with it.

If you have a quote (") somewhere in the text, it may take away good part of code including your m3. I'd recommend you to enable auto-close quotes. In this case if you enter one, its pair will be auto-added and therefore the code will still be valid (from grammar perspectives), and your m3 won't disappear.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 11 May 2008
Posts: 78
Reply with quote
Thanks for your reply. Now it makes sense as I read your post.
The opening quote (single or double) renders all the following text (code) as part of the string itself and the m3 'disappears' from the code as it is part of the string now (at least up to the next quote downwards).
Still, I thought the parser would have considered the last working state (before the error that occured after openning the first quote) of the methods database, but all in all this is just a thought and not important at all.
As to autoclosing quotes, I do always disable this because often times when I edit strings/enter quotes, I want it predictable and I don't want the extra effort to delete quotes when they appear here and there automatically.
Ok, I agree this is the normal behavior, although at the time the opening quote is written the parser already knew the method and its parameters (because we are in the middle of calling it and after the first parenthesis, and it was all about the parameters hint) - I saw such behavior in other IDEs that's why I was wondering if this was a bug in Phped. Not a big deal anyway.
View user's profileFind all posts by tedychSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
I'm not sure what would help "the other" IDE to recover from a non-closed quote. Perhaps, they are lazy in re-parsing the file that you work with. If so, it would be enough to wait for 1-2 seconds and check again.
Regarding "remember its state", it's not possible without bringing even more problems. Imagine, you have just deleted a bunch of methods and made a little syntax error. Would you like to see deleted methods in code completion? But you will if phped does not re-parse the file.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 11 May 2008
Posts: 78
Reply with quote
At the time just before I enter the quote after the opening parenthesis, the syntax was error-free and the last state - stable. It should be evident that the single character (quote) is not "deleted a bunch of methods" in this particular case.
"The other" IDE - yes I waited for long enough, it flashed the parameter hint for a moment and persisted until I closed the parenthesis ")". Smile . Maybe just some kind of relaxed intelligent parsing in this case when it was not possible to have deleted a method when calling one in the parenthesis. Having the paremeters tooltip disappear when I enter a string parameter was just a small annoyance (if using automatically closed quotes, I still would have to jump after the closing quote with the right arrow when done with the string).
Anyway, this was more of thoughts aloud, it is Ok as it is. Still, I think Phped has the most intelligent code completion engine out there, despite the many missing code features as seen elsewhere.
View user's profileFind all posts by tedychSend private message
Parameter hints for subsequent methods
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic