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

first --- comment after module comment is ignored if there is any non-comment before it #410

Open
GinjaNinja32 opened this issue Oct 21, 2024 · 0 comments

Comments

@GinjaNinja32
Copy link

GinjaNinja32 commented Oct 21, 2024

bisected, caused by #396.

search_for_token searches through the file, stopping if it encounters the target token or a --- comment.
if it advances the position, finds a comment, but then find_module doesn't return the t,v that SFT returns, then parse_file never actually processes the comment that was found.

a slight modification of the example from #396 that shows the issue; DoNothing is entirely absent from the generated docs:

--- my module

local v = 42

--- my function
-- takes nothing and returns nothing
-- @return nothing
function DoNothing()
end

--- my thing
Thing = {
}

the "contains no items" warning only triggers if there is no module() call and no --- comments other than the module comment in the entire file, which is potentially a reasonable case to warn about - the reason it triggered on the example in #396 is that the doc on DoNothing() was actually parsed as the module comment, and then there were no documented items beyond that (i.e. there actually were no items, as the warning said!). Adding an actual module comment to it (as in my example above) makes the warning go away even with the pre-#396 code.

I would still like a way to turn the warning off or ignore it - maybe a pragma? The reason I'm even looking at this code in the first place is that I have modules that actually don't have any items, because they just register themselves with other modules and don't expose any functions/etc themselves, and I'd like to use --fatalwarnings but can't because of the "no items" warning 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant