Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global functions aren't exported #1943

Closed
Nightmare82 opened this issue Feb 25, 2023 · 12 comments
Closed

Global functions aren't exported #1943

Nightmare82 opened this issue Feb 25, 2023 · 12 comments
Labels
bug Something isn't working

Comments

@Nightmare82
Copy link

Nightmare82 commented Feb 25, 2023

When I export documentation it contains all my types and their methods but the global functions are missing.

As an example this is how a file looks like and the function isn't part of the exported documentation:

---@meta

---@return string String parameter
---@param propertyName string name of the property
---@param defaultValue string Default value
---@param description string Description of the property
function getStringParameter(propertyName, defaultValue, description)
end

Is this a bug or am I doing something wrong ?

My goal is to document all functions of my custom engine. It works nicely for all my types and methods but seems like I'm doing something wrong for the functions.

@carsakiller
Copy link
Collaborator

Try removing the @meta annotation. I think the documentation generation is meant to generate documentation from your code, not your definition files (as those would have already been generated, in theory).

@Nightmare82
Copy link
Author

Try removing the @meta annotation. I think the documentation generation is meant to generate documentation from your code, not your definition files (as those would have already been generated, in theory).

Thanks for the suggestion! Unfortunately this doesn't change the behavior in my test. I will try it with a minimal example to make sure it's not a side effect of something else at next.

@Nightmare82
Copy link
Author

It also doesn't work with a minimalistic example(a single function), with or without the meta annotation

@sumneko sumneko added the bug Something isn't working label Feb 27, 2023
@sumneko
Copy link
Collaborator

sumneko commented Feb 27, 2023

I missed this case since I never used global functions

@Nightmare82
Copy link
Author

I missed this case since I never used global functions

Ok, thanks for the confirmation! Do you plan to add that in the near future ? Otherwise maybe I will rework my API to not use global functions.(Which sounds like a good choice anyway 😀)

@sumneko sumneko closed this as completed in 84ef83e Mar 9, 2023
@Nightmare82
Copy link
Author

Nightmare82 commented Mar 10, 2023

Thanks for adding support for that!

Do I have to do anything special to be able to export global functions ? It doesn't work for me with the example posted above. (With or without the meta annotation) @sumneko (Version 3.6.17)

@sumneko sumneko reopened this Mar 11, 2023
@sumneko
Copy link
Collaborator

sumneko commented Mar 11, 2023

Could you provide a demo file for me to test?

@Nightmare82
Copy link
Author

@sumneko The example I mentioned above in a single lua file doesn't produce any output for example.
An even more minimal example would be:

---@meta

function dummy() end

If there is any other way to export global functions please let me know.

@sumneko
Copy link
Collaborator

sumneko commented Mar 13, 2023

@sumneko The example I mentioned above in a single lua file doesn't produce any output for example. An even more minimal example would be:

---@meta

function dummy() end

If there is any other way to export global functions please let me know.

Currently I would not export anything from meta files, since I don't want to export basic functions (e.g. io.open, math.random).
I will find another way to exclude basic functions.

sumneko added a commit that referenced this issue Mar 13, 2023
@Nightmare82
Copy link
Author

@sumneko in the newest version this is supported, right ? how is it supposed to work ?

@Nightmare82
Copy link
Author

@sumneko Could you please give me an update if this feature is supposed to work now ? (And if it is could you tell me how to export global functions)

@Nightmare82
Copy link
Author

Sorry, this time it was an error on my side, it works great. Thanks a lot for adding this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants