swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
762 stars 55 forks source link

Add Swift Documentation Preview Support #562

Open Kyle-Ye opened 1 year ago

Kyle-Ye commented 1 year ago

Is your feature request related to a problem? Please describe.

When user actives documentation preview panel and is currently on a .swift, .h or .markdown file, preview the documentation on the right panel.

Describe the solution you'd like

It can be achieved by using the existing ConvertService API provided by DocC.

No Xcode magic is required.

https://twitter.com/franklinschrans/status/1666343700442628098

Benefits

Improve the doc-writing experience on non-Xcode IDE.

Additional context

Inspiration: Xcode 15's documentation preview feature

See more info https://developer.apple.com/videos/play/wwdc2023/10244/

adam-fowler commented 1 year ago

You can use the command Markdown: Open preview to the side to give a markdown preview. This won't give you the full docc preview obviously but it is a start.

Kyle-Ye commented 1 year ago

You can use the command Markdown: Open preview to the side to give a markdown preview. This won't give you the full docc preview obviously but it is a start.

Yeah. VSCode has a build-in Markdown preview panel.

But I'd like to know if it was possible to render a HTML directly in a associated-panel(The same as Markdown file and Markdown-Preview panel) via the VSCode plugin SDK.

adam-fowler commented 1 year ago

You can do it. But managing the preview server, associating the current page with the correct page on the server isn't simple. It is all possible, just complex.

I have looked into to it a bit and got it displaying a page served by preview server I was running separately. But it is far away from a finished feature.

roydbt commented 8 months ago

Any updates on this issue?

adam-fowler commented 8 months ago

No update on this. I haven't had anymore time to look into it.

daveyc123 commented 7 months ago

@adam-fowler Can we grab this one? If so, do you have your prototype changes in a fork somewhere?

adam-fowler commented 7 months ago

@daveyc123 its all yours. I had some basic code setup to display the documentation but there was a loads of issues managing the preview server and updating the documentation. Don't think I kept any of the code around though.

adam-fowler commented 7 months ago

@daveyc123 I found this https://github.com/adam-fowler/vscode-swift/tree/documentation-preview

daveyc123 commented 7 months ago

Thanks for digging that up @adam-fowler

matthewbastien commented 1 month ago

I just posted a general overview of how this feature could be implemented on the Swift forums: https://forums.swift.org/t/rfc-swift-docc-integration/75537

Please check it out and leave any feedback/suggestions that you might have!