Page 1 of 1
Add Macro const,procedures,prototypes to AutoComplete/Help
Posted: Tue Aug 12, 2014 11:27 pm
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
Re: Add Macro const,procedures,prototypes to AutoComplete/He
Posted: Thu Aug 14, 2014 10:50 am
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.
Re: Add Macro const,procedures,prototypes to AutoComplete/He
Posted: Thu Aug 14, 2014 12:56 pm
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.
Re: Add Macro const,procedures,prototypes to AutoComplete/He
Posted: Thu Aug 14, 2014 1:08 pm
by NicTheQuick
+1
Re: Add Macro const,procedures,prototypes to AutoComplete/He
Posted: Thu Aug 14, 2014 1:14 pm
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
Re: Add Macro const,procedures,prototypes to AutoComplete/He
Posted: Thu Aug 14, 2014 2:31 pm
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"
Re: Add Macro const,procedures,prototypes to AutoComplete/He
Posted: Thu Aug 14, 2014 10:20 pm
by graph100
well, this is why it was named "silly code example"
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

Re: Add Macro const,procedures,prototypes to AutoComplete/He
Posted: Thu Aug 14, 2014 11:40 pm
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.