[IDE-v542] Wrong Procedure Context Help chosen.

Just starting out? Need help? Post your questions and find answers here.
User avatar
skywalk
Addict
Addict
Posts: 3999
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

[IDE-v542] Wrong Procedure Context Help chosen.

Post by skywalk »

With Modules...

Code: Select all

DeclareModule ContextHelp
  CompilerIf 0    ;<-- Does not matter if 0 or 1?
    Declare MyProc2(Why Does This Appear In Context Help?)
  CompilerElse
    Declare MyProc2(x$, y.d = #PI, z$ = "")
  CompilerEndIf
EndDeclareModule

Module ContextHelp
  Procedure MyProc2(x$, y.d = #PI, z$ = "")
    Debug x$
  EndProcedure
EndModule
ContextHelp::MyProc2("Context Help is wrong!")
Without Modules...

Code: Select all

CompilerIf 0
  Declare MyProc(x$, y.d = #PI, z$ = "")
CompilerElse
  Declare MyProc(This Should Appear In Context Help?)
CompilerEndIf

Procedure MyProc(x$, y.d = #PI, z$ = "")
  Debug x$
EndProcedure
MyProc("Context Help is wrong!")  ;<-- Syntax error, but Context Help is wrong!?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Demivec
Addict
Addict
Posts: 4091
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: [IDE-v542] Wrong Procedure Context Help chosen.

Post by Demivec »

Here's a quote from Fred:
The IDE can't resolve the CompilerIf (it's [sic] ;), so you will have to write it differently if you want the IDE to behave correctly.
User avatar
skywalk
Addict
Addict
Posts: 3999
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: [IDE-v542] Wrong Procedure Context Help chosen.

Post by skywalk »

Yes, I remember that for syntax highlighting and folding, but this is a bit deeper where the IDE is reading a procedure or prototype definition and should respect the CompilerIf's. If this is not true, it should be mentioned in the Help manual.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Demivec
Addict
Addict
Posts: 4091
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: [IDE-v542] Wrong Procedure Context Help chosen.

Post by Demivec »

skywalk wrote:Yes, I remember that for syntax highlighting and folding, but this is a bit deeper where the IDE is reading a procedure or prototype definition and should respect the CompilerIf's. If this is not true, it should be mentioned in the Help manual.
Since CompilerIf's can't be evaluated there isn't a perfect solution to multiple prototypes being present. Either it's the first definition, the last definition, or no definition that would be the one chosen. Which would be your preference?

jaPBe dealt with this problem by using whichever prototype was last entered (technicality, the one that last had the cursor placed on it's line). Which meant if you cursor'ed through the lines the auto-complete would change depending on the line you last visited. Similar problem, different solution. It is pretty hard to out-think clever programmers. :)

The method used could be mentioned in the Help manual, though I think you would probably only look there after you first encountered a problem. The next question is where it would be placed.
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: [IDE-v542] Wrong Procedure Context Help chosen.

Post by freak »

The IDE does lexical analysis, not compilation. Such constructs can only be resolved with 100% certainty by doing a full compilation.

Not a bug.
quidquid Latine dictum sit altum videtur
User avatar
skywalk
Addict
Addict
Posts: 3999
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: [IDE-v542] Wrong Procedure Context Help chosen.

Post by skywalk »

Ok, not a bug, but certainly not expected behavior.
Can this be noted in Help under Context Help?

I would prefer sourcing from a compiled list of known definitions.
The compiler is so fast, it merely needs a few seconds to make this accurate.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: [IDE-v542] Wrong Procedure Context Help chosen.

Post by Tenaja »

skywalk wrote:Ok, not a bug, but certainly not expected behavior.
Can this be noted in Help under Context Help?

I would prefer sourcing from a compiled list of known definitions.
The compiler is so fast, it merely needs a few seconds to make this accurate.
So you wouldn't mind waiting a few seconds for each keystroke? Because that is basically what you are asking for.
User avatar
skywalk
Addict
Addict
Posts: 3999
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: [IDE-v542] Wrong Procedure Context Help chosen.

Post by skywalk »

How so? This would only occur for CompilerIf's. Remember, the ide is already busy with every keystroke and linefeed and it is not seconds.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply