BGforgeNet / VScode-BGforge-MLS

BGforge MultiLanguage server
https://forums.bgforge.net/viewforum.php?f=35
Other
16 stars 5 forks source link

Use parameters data from actual code when jsdoc is used #72

Closed phobos2077 closed 4 months ago

phobos2077 commented 5 months ago

Screenshot

изображение

What's wrong on screenshot

Code

/**
 * Adds one recipe item for a given crafted item, if it doesn't exist. If recipe is known, deletes the item.
 * 
 * @arg {int} schematicPid - PID of schematic item to create
 * @arg {int} probability - % probability of spawn, if conditions are met.
 */
procedure check_restock_craft_schematic(variable schematicPid, variable craftedItemPid, variable probability := 100) begin
end
phobos2077 commented 5 months ago

Would also be nice to parse and display comment after @ret

burner1024 commented 5 months ago

I don't like duplication. But I also don't like mixing info from different sources. I think it can get too complicated for too little gain. Need to think about it. Maybe make an exception for default values, but I definitely don't want to merge argument lists. Although trusting just one source seems more reliable still.

For functions with return values, the description of those is usually the first thing in the body of the docstring. So, not sure if that's any benefit.

phobos2077 commented 5 months ago

But I also don't like mixing info from different sources. I think it can get too complicated for too little gain.

Simple idea: if there's not a single @arg in comment, then you just take data from code (and put any as type). Otherwise trust the @args. This should fix the common case where you just want to put some description without writing out every arg.

For functions with return values, the description of those is usually the first thing in the body of the docstring. So, not sure if that's any benefit.

It's just a simple readability improvement - you see return value described after arguments, like it usually is in documentation.

burner1024 commented 4 months ago

It's just a simple readability improvement - you see return value described after arguments, like it usually is in documentation.

Usually... where? Because this is what I usually see Captura desde 2024-05-23 15-51-00

burner1024 commented 4 months ago

For args, I think default form will do Captura desde 2024-05-23 16-32-52

burner1024 commented 4 months ago

If there's nothing to add about ret, I guess that'll be all.

phobos2077 commented 4 months ago

If there's nothing to add about ret, I guess that'll be all.

I mean, it would still be useful to be able to describe return value. But it's not as critical.

burner1024 commented 4 months ago

I showed how it's usually described in my experience. If your experience differs, feel free to share.

phobos2077 commented 4 months ago

If your experience differs, feel free to share.

Well I come from C# background. There comments have a structure with return value having it's own tag that describes what is returned separately.

As I said, it's not very important, but a feature you would expect when writing structured comments. Why args have comment but ret does not? Feels inconsistent.