-
Notifications
You must be signed in to change notification settings - Fork 127
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
Support resolving code file references in ConvertService #570
Support resolving code file references in ConvertService #570
Conversation
@swift-ci please test |
@@ -74,6 +76,21 @@ public struct RenderNodeTranslator: SemanticVisitor { | |||
return assetReference | |||
} | |||
|
|||
private func fileContents(with fileReference: ResourceReference) -> String? { | |||
// Check if the file is a local asset that can be read directly from the context | |||
if let fileData = try? context.resource(with: fileReference) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: It looks like this logic is duplicated at least once – should we consider moving this to a specific method in the DocumentationContext
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Twice is below my threshold for duplication of something this small. I'm also thinking that this behavior would probably conceptually be more relevant to the asset manager or the data provider but moving it to either of those places would be bigger than this.
@swift-ci please test |
* Support resolving code file references in ConvertService rdar://107965493 * Support highlighting lines in resolved file assets
* Support resolving code file references in ConvertService rdar://107965493 * Support highlighting lines in resolved file assets
Bug/issue #, if applicable: rdar://107965493
Summary
This enables convert service requests to resolve file assets that are references in the tutorial steps. This is done by asking the context to resolve the file asset if its data doesn't already exist.
Dependencies
None
Testing
In a client that uses
ConvertService
:@Code
references result in DocC returning a render node with file references for those code files with line highlights for the differences between the files' content.Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded