-
Notifications
You must be signed in to change notification settings - Fork 98
Show all or none conformances in the declaration #124
Comments
I agree that it's confusing when a type's declaration is at odds with its actual inheritance graph. However, I don't see a good way to change the declaration itself to resolve this when we don't know the types in the inheritance list.
My goal was for the inheritance graph image to be the primary interface for understanding and navigating type relations. Is there anything we could add or change to the UI that could help reconcile this confusion? |
Is this a permanent limitation or could it be improved in the future? Any reason SwiftDoc is using |
Sorry for interjecting, but my understanding is that it requires the AST that Shameless selfish plug, one could also pick up Typology and improve its own type checker, which is written in pure Swift, as opposed to IndexStore's C++. I don't know what is the best way long term, I personally would prefer IndexStore's documentation to be improved and more code in it to be migrated from C++ to Swift. Typology was created primarily as an educational project, but maybe it could help someone to get their feet wet with the whole area of type checking/symbol resolution. |
This is a temporary limitation of only using a syntactic parse.
A syntactic parse can be performed without compilation, which means it can run up to several orders of magnitude faster. It's not a complete picture, but it's often more than enough to be useful. We're exploring using IndexStoreDB in #31 to fill in missing context. I've also struggled to work with IndexStoreDB. It could be my own lack of understanding, but I ended up forking and adding a few APIs to access the information I needed (USRs by type, queryable by name and source location). That's still a work-in-progress. We should treat a compiler-generated artifact like an index store as the canonical source of truth for filling in context, but there's still some low-hanging fruit for improving how we do type inference. The current approach is clearly suboptimal. If you think Typology can help here, I'd be very interested to see a proof of concept. |
While performance is nice, docs are usually only generated when releasing a new version of a project and is done in a GitHub Action, so whether it takes 1 second or 1 minute, doesn't really matter, at least for me. Having accurate & comprehensive type information and readable docs is much more important. |
@mattt is any of that work public? Would you mind sharing it? I hope I could contribute at some point if so. |
The overwhelming feedback I've gotten so far is that speed is What I'm saying is that it doesn't have to be an either-or. Similar to how Swift has a Here's my fork: https://github.com/SwiftDocOrg/indexstore-db Here's my WIP / experimentation from a few weeks back: swift-doc/Sources/swift-doc/main.swift Lines 20 to 58 in 55f282f
|
If a type has conformances defined both in the main type declaration and in extensions,
swift-doc
only shows the ones defined directly in type in the docs declaration.For example, this type conforms to
Hashable
andCodable
directly in the type, but also conforms to many other things in extensions. However, inswift-docs
, it only shows:Which feels a bit misleading, as it conforms to other types too, which are documented in the "Conforms To" section, but that can easily be missed and confuse users. I don't see why conformances directly on the type are more important than ones defined in extensions.
My recommendation is to either show all conformances or none in the declaration code block.
The text was updated successfully, but these errors were encountered: