-
Notifications
You must be signed in to change notification settings - Fork 414
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
Docs for NSError extension (specifically) don't get parsed. #502
Comments
This seems to be the case for UIColor, UIFont, CLLocation extensions as well. But works for Float, String, UIView extensions. I thought this might be related to Swift types vs. Obj-C types but UIView works fine ... |
Do you have the necessary import statements in those files? |
This is happening to me with a UIFont extension. The file has |
@segiddins what do you mean by that? Those files have the regular imports just like the rest of my files that are recognized. This seems specific to extensions for those classes. |
In that case, a project that reproduces the issue would be the first step towards debugging. |
Absolutely. Taking care of that now. |
Ah so jazzy should be documenting children of undocumented extensions always, this looks like a bug! |
The problem is it actually IS documented... It recognises it as undocumented for some reason , despite recognising String as documented, both follow the same "rules" of documentation... |
Can confirm that it does produce docs for my UIFont methods when skip-undocumented is off, but does not recognize the documentation for the extension itself (says "Undocumented"). On the other hand, my UIImage extension does not have extension-level documentation, but jazzy still generates a site for the one method inside, even with skip-undocumented (the method is documented but the extension isn't, and the header doesn't say "Undocumented"). |
Can all of you please try using jazzy built from source from the |
Yes it works for some things and doesn't for other things. |
@jpsim Will try. I'm not exactly sure how but will give it a shot ;) |
Thanks! You can follow the instructions at https://github.com/realm/jazzy#development. |
I compiled master and ran the binary, the issue persists. As proof that I'm on the latest: "module-name" was renamed "module". |
Ok, let's keep this open until someone has the time to debug & fix then. Thanks for checking against |
No problem, keep up the awesome work! |
Have this issue as well for my category. A solution is not always straight forward, because if there are multiple categories/extensions on the same class, they are merged together. In that case, which documentation should be used? |
One quick fix is to disable the following lines in sourcekitten.rb: def self.make_doc_info(doc, declaration)
return unless should_document?(doc)
# unless doc['key.doc.full_as_xml']
# return process_undocumented_token(doc, declaration)
# end
declaration.line = doc['key.doc.line']
declaration.column = doc['key.doc.column']
declaration.declaration = Highlighter.highlight(
doc['key.doc.declaration'] || doc['key.parsed_declaration'],
Config.instance.objc_mode ? 'objc' : 'swift',
)
declaration.abstract = Jazzy.markdown.render(doc['key.doc.comment'] || '')
declaration.discussion = ''
declaration.return = make_paragraphs(doc, 'key.doc.result_discussion')
declaration.parameters = parameters(doc)
@documented_count += 1
end This creates the documentation correctly. Not sure what |
I'm not sure that's a quick fix, since that would also break actual undocumented documents, If I'm not mistaken. |
Perhaps determining if a document is documented should be determined differently? |
@freak4pc What if it is changed like so: def self.make_doc_info(doc, declaration)
return unless should_document?(doc)
if doc['key.doc.comment'].nil?
return process_undocumented_token(doc, declaration)
end
declaration.line = doc['key.doc.line']
declaration.column = doc['key.doc.column']
declaration.declaration = Highlighter.highlight(
doc['key.doc.declaration'] || doc['key.parsed_declaration'],
Config.instance.objc_mode ? 'objc' : 'swift',
)
declaration.abstract = Jazzy.markdown.render(doc['key.doc.comment'] || '')
declaration.discussion = ''
declaration.return = make_paragraphs(doc, 'key.doc.result_discussion')
declaration.parameters = parameters(doc)
@documented_count += 1
end Quickly tested, and it seems to correctly display "Undocumented" if no documentation is provided, but also correctly documents extended classes. |
@jpsim @segiddins What do you guys think? Could this be submitted as a PR ? |
If it doesn't break any other tests, sure. |
I'm not sure how to test. My usage is very limited. |
@LeoNatan , let me take care of that, write up a PR for this and I'll submit it and mention you, if that's ok ? |
Sure, no problem. |
@LeoNatan Tried your solution but it seems that makes it worse... Now it only documents my UIView extension and skips even the single ones it did before. This doesn't seem to be the right solution ... need to keep digging :) |
Hehe, as I said, my use cases are very limited and it seems to have worked for me. Can you post an example project where this reproduces? I may try to look further tomorrow. |
Tracked it down, submitting a PR in a bit. ;) |
Uhm that seems to break some of the tests . I'm not sure exactly why. If one of you guys perhaps can assist in making this compatible? |
Let's continue the conversation in #508. I'm not in my "jazzy head space" right now, so I haven't fully understood the ramifications of such changes, but I'll be able to review further once I can see the changes as discussed in #508. |
Closing since the conversation has continued in a PR. |
I have some extensions that are all being parsed correctly, for example, this gets detected with no issues and generates valid HTML docs:
But specifically my NSError extensions are being skipped for some reason and docs are never generated even though they follow the same format:
This is how it looks:
This is even weirder since jazzy outputs parsing of the file, but doesn't generate the docs from it e.g.
Parsing NSError.Exts.swift (27/47)
.Would appreciate any help on this !
Kind Regards,
Shai.
The text was updated successfully, but these errors were encountered: