Add Macro const,procedures,prototypes to AutoComplete/Help

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Add Macro const,procedures,prototypes to AutoComplete/Help

Post by skywalk »

Like many others, I use Macros for automation of code building. But, I cannot get context help or AutoCompletion for any Constants, Procedures, or Prototypes defined in a Macro.

Code: Select all

; Silly code example...
Macro x()
  #c_in_macro_x = 1
  Prototype.i xx(a.i)
  Procedure.i yy(b.i)
    ProcedureReturn 1
  EndProcedure
EndMacro
#c_in ;<-- typing here does not trigger autocomplete
xx(2) ;<-- typing here does not show any context help in statusbar
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
graph100
Enthusiast
Enthusiast
Posts: 115
Joined: Tue Aug 10, 2010 3:17 pm

Re: Add Macro const,procedures,prototypes to AutoComplete/He

Post by graph100 »

I would very much appreciate it too !

But I believe the macros must be processed in "real coding time" for it to come true.
So It would be a awfully powerful feature, but really cpu time demanding.
_________________________________________________
My Website : CeriseCode (Warning : perpetual changes & not completed ;))
User avatar
Derren
Enthusiast
Enthusiast
Posts: 316
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Add Macro const,procedures,prototypes to AutoComplete/He

Post by Derren »

graph100 wrote:But I believe the macros must be processed in "real coding time" for it to come true.
So It would be a awfully powerful feature, but really cpu time demanding.
No. We're talking about the macro definition here, not the replacement of the macro call with the macro code.
This should be an easy fix.
User avatar
NicTheQuick
Addict
Addict
Posts: 1503
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: Add Macro const,procedures,prototypes to AutoComplete/He

Post by NicTheQuick »

+1
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
graph100
Enthusiast
Enthusiast
Posts: 115
Joined: Tue Aug 10, 2010 3:17 pm

Re: Add Macro const,procedures,prototypes to AutoComplete/He

Post by graph100 »

so you think this should not be concerned by the demand of skywalk ?

Code: Select all

; Silly code example...
Macro x(_name_)
	#c_in_macro_#_name_ = 1
	Prototype.i proto#_name_(a.i)
	Procedure.i proc#_name_(b.i)
		ProcedureReturn 1
	EndProcedure
EndMacro
#c_in ;<-- typing here does not trigger autocomplete
pro(2) ;<-- typing here does not show any context help in statusbar
_________________________________________________
My Website : CeriseCode (Warning : perpetual changes & not completed ;))
User avatar
Derren
Enthusiast
Enthusiast
Posts: 316
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Add Macro const,procedures,prototypes to AutoComplete/He

Post by Derren »

Sorry, I was only focusing on the example by skywalk which did not use variable naming.

Your example doesn't make sense as it is.
The constant's name isn't actually known until the macro is called (unlike in skywalk's example).
So when you add that, the compiler would need to expand the macro. It's not as easy as changing the "scope", but not as time consuming as you might think either. The macro doesn't need to be compiled or anything. Upon calling, the constants, variables and procedure names just need to be expanded and added to the list.
It requires some parsing, yes, but I don't think it will steal too much CPU.

Also, what would still be easily possible is to offer an autocomlete list or status bar help up until the variable point. That would require no further parsing.

Code: Select all

Macro x(_name_)
   #c_in_macro_#_name_ = 1
EndMacro 

#c_in ;would expand to #c_in_macro_ and you'd only have to type the "name"
User avatar
graph100
Enthusiast
Enthusiast
Posts: 115
Joined: Tue Aug 10, 2010 3:17 pm

Re: Add Macro const,procedures,prototypes to AutoComplete/He

Post by graph100 »

well, this is why it was named "silly code example" :lol:
but I agree with you, that it must be doable.

I can't think of a specific example, but I know that it happened that I didn't use a macro because the autocompletion would not be working. And that I lose some time because of it.

So this is why I support skywalk demand, and add the expanded stuff on the list :D
_________________________________________________
My Website : CeriseCode (Warning : perpetual changes & not completed ;))
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Add Macro const,procedures,prototypes to AutoComplete/He

Post by skywalk »

When I convert C headers to pbi's I have to put the prototypes in the main code but the rest can go in a Procedure. The Macro would be ideal to house all lib related items, but as I said, losing autocomplete/context help is a no go.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply