Xojo extra function documentation

Hi,

This is something so basic to any programming language the Xojo IDE seems to be missing (or maybe I learn something new)

Most languages have a functionality to document a function or sub. e.g just before the function (in the case of Xojo, it could be just after the declaration):

/**

  • Function: MyAdd()
  • Description: Adds two numbers
  • Params: FirstNum as integer: the first number
  •              SecondNum: the number to add to the first one
    
  • Returns: an integer containing the sum of the first and the second number
    */

When someone uses the MyAdd() function in the IDE, they get a nice description that helps them using the function.

I’m asking because for my Augmented Reality framework, I would like to describe the functions. A lot of functions do require a lot more info that knowing what type a parameter is. So the one line function description at the bottom is really insufficient.

Documenting everything in a seperate document is also so '80s. A modern IDE should have this functionality build-in.

Fingers crossed there is something I’m not aware of in Xojo :slight_smile:

Cheers,

Alain

Alain, did you look on the base of the editor? When you hover with the mouse arrow over a function, method or the like, it shows you the required parameters and the returned value kind.

Ah sorry, I missed that you have found that. So it‘s about further documentation. Did you consider suggesting that on Feedback (after checking if a similar proposal already exists)?

@Ulrich Bogun Thanks for the reply! I thought a stepped on someone’s toes :wink:

I can’t use Feedback because I’m still only licensed for an older version and I think the guys have their hands full with other stuff.
Once that’s done, they can upgrade the IDE.

It’s not that urgent. It was more to make it easier for the people who are going to download the framework and this would be a great help for them. For me, all functions are crystal clear :slight_smile: Would have been a pity if I didn’t build it in if it already existed in Xojo.

Cheers,

Alain

No, why should you?

I like the idea, would reduce the time I have to look into the online reference while programming. The Xojo engineers surely have a lot to do, but that’s what Feedback is for – to keep track of bugs and suggestions to further improve the IDE. If you don’t mind, I would set up a Feedback proposal with that concept.

A similar suggestion exists from 2011 when the topic of a new IDE first arose (when Xojo was Real Studio still). Some even suggested in the beta list, being able to click a function or keyword, and have an “in-IDE” pane display the docs so you’d never have to leave the IDE or switch windows/tabs…The bottom of the code editor is what came of it.

Why not use comments
//this is a comment
To document te function right within the code?

Please do! I think this would be a great feature. Thanks!

Suggestions on this forum can sometimes turn into pointless flaming lately (like the ++ post, which was a valid ‘advanced’ functionality suggestion also imho). This was not the purpose at all of this post. (I’m really getting to soft :slight_smile:

[quote=90105:@Roger Clary]Why not use comments
//this is a comment
To document te function right within the code?[/quote]

Because then you still have to be counterproductive and leave the code you are currently entering to keep checking what your comments say :slight_smile:

One way to get around it is to use really long descriptive argument names in your functions. :-/

@Matthew Combatti I suspected something like that. And it’s probably for 95% of the users enough. But for the other 5% who like to write bigger frameworks for others, a bigger one would be helpfull. You probably met a similar problem with the SimDesignerCanvas (love it by the way. It’s always great to see someone putting the best control in Xojo to a higher level :slight_smile:

Do you provide some help with your controls (and do you use some tool to generate it?)

[quote=90109:@Matthew Combatti]Because then you still have to be counterproductive and leave the code you are currently entering to keep checking what your comments say :slight_smile:

One way to get around it is to use really long descriptive argument names in your functions. :-/[/quote]

Another option, which doesn’t solve the problem but at least helps with the need, is using something like Dash and provide the documentation there (it could be in the code in a way that can be extracted for Dash automatically)

Exactly!

[quote=90020:@Alain Bailleul]So the one line function description at the bottom is really insufficient.
[/quote]
Paste in as much text as you like
That editor should be showing as multiline but its not (bug)
The other bug is that the pane at the bottom of the code editor is NOT showing the signature + the description you typed in
So right now those descriptions aren’t as useful as intended

Just add it to my pile :slight_smile:

Alain, so I would take the main part of your initial question and put that into Feedback. Any suggestions you have about how this could/should be handled or leave it up to Norman’s decision?

@Norman Palardy Aha! So some kind of system is already in it for a description, but not used yet. The fix is probably:
SignDesc.Caption = Signature + chr(13) + Description :slight_smile:

@Ulrich Bogun I like a system like the following, but that’s because it’s similar to other languages and fits in the flow when you are typing code (not having to swiitch to the mouse). Being able to type what you want without restrictions is also nice. But off course, let Norman use his fanatasy :slight_smile:

Function MyAdd(val1 as integer, val2 as integer) as integer #pragma description # Function: MyAdd # Description: The best add EVER! # Params: val1 as integer = the first value # val2 as integer = the value to add to val1 # Returns: the sum of val1 and val2 #pragma enddescription return val1+val2 End Function

Done, feedback case 33630. I set this up as a bug report according to Norman, although it’s a suggestion as well.

Thanks for bringing that one up, Alain!

For what it’s worth, if you like having comments in your code and are using Xojo (or a version of the previous IDE that has IDEScripting) you could make a little script like this:

[code] if instr(text,"//") = 0 then
dim header() as string
header.append "//
"
header.append “//”
header.append “// Name: " + nthfield(location,”.",countfields(location,"."))
header.append “// Description:”
header.append “// Params:”
header.append “// Returns:”
header.append “//”
header.append "//
*"
header.append “”
header.append text

text = join(header,endofline)

end if[/code]

@Greg O’Lone Interesting suggestion. Gonna try that one out!