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

Rebuild docs when snippet changes. #59

Open
2 tasks done
mbrandonw opened this issue May 18, 2023 · 3 comments
Open
2 tasks done

Rebuild docs when snippet changes. #59

mbrandonw opened this issue May 18, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@mbrandonw
Copy link

Description

When previewing docs with the swift package preview-documentation I have found that changes made to snippet files (in the Snippets root directory) do not trigger a rebuild of docs. This makes it hard to iterate on documentation that uses snippets.

Further, I found found that snippets in the generated docs will update unless the preview server is stopped and restarted. For example, I can perform the following steps:

  • Start the preview server for my docs (i.e. swift package preview-documentation)
  • Open docs and confirm everything is running correctly
  • Make a change to a snippet file in the Snippets directory
  • Make a change to a documentation file
  • Confirm that the docs did rebuild in Terminal
  • Open the docs and see the old version of the snippet.

The only way to see the newest version of the snippet is to stop the preview server and start it again.

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected Behavior

I would hope that any changes to a snippet file or the main docs would rebuild all of the docs with the freshest version of all snippets.

Actual behavior

Snippets are not re-generated unless I stop the preview server and restart it.

Steps To Reproduce

No response

Swift-DocC Version Information

1.2.0

Swift Compiler Version Information

swift-driver version: 1.75.2 Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0
@mbrandonw mbrandonw added the bug Something isn't working label May 18, 2023
@ethan-kusters ethan-kusters transferred this issue from swiftlang/swift-docc May 18, 2023
@ethan-kusters
Copy link
Contributor

ethan-kusters commented May 18, 2023

Keeping this issue as snippet-focused makes sense to me but note that this problem affects any source code change. The live update feature currently only supports changes in markdown files – so any changes in a project's source code will not be reflected without a complete rebuild.

@natikgadzhi
Copy link
Contributor

@ethan-kusters, it looks like the preview action in docc monitors the documentation bundle, but not other directories in the source tree.

A naive approach could be to set the project root (containing the docs bundle) as monitoring target, so any file change would trigger a rebuild?

The problem with that is that DirectoryMonitor will re-run convertAction on every change, i.e. rebuild the whole thing from scratch (unless docc has caching internally that I don't know about yet).

Rebuilding docs on code change would also require building the code (at least obtaining a fresh symbols.json). At least that part is already incremental.

Sounds like a topic for another RFC to align on possible approaches with sane performance costs?

@Joannis
Copy link
Member

Joannis commented Jun 8, 2024

Is this issue still being considered?

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

4 participants