|
| 1 | +--- |
| 2 | +layout: new-layouts/post |
| 3 | +published: true |
| 4 | +date: 2025-02-NN 10:00:00 |
| 5 | +title: 'Swift GSoC 2025 highlight: Improve the display of documentation during code completion in SourceKit-LSP |
| 6 | +author: [ktoso, ahmedelrefaey, hamish] |
| 7 | +category: "Community" |
| 8 | +--- |
| 9 | +
|
| 10 | +Another year of successful Swift participation in [Google Summer of Code](https://summerofcode.withgoogle.com) 2025 came to an end recently, and this year we'd like to shine some light on the projects and work acomplished during the summer! |
| 11 | + |
| 12 | +Summer of Code is an annual program, organized by Google, which provides hands-on experience for newcomers contributing |
| 13 | +to open source projects. Participants usually are students, but do not have to be. |
| 14 | + |
| 15 | +In this series of four posts, we'll highlight each of the Summer of Code contributors and their projects. |
| 16 | + |
| 17 | +- [Bringing Swiftly support to VS Code](2025-11-NN-swift-gsoc-2025-highlight-1-vscode-swiftly.md) |
| 18 | +- [JNI mode for swift-java’s source jextract tool](2025-11-NN-swift-gsoc-2025-highlight-2-swift-java-jextract-jni-mode.md) |
| 19 | +- Improve the display of documentation during code completion in SourceKit-LSP (this post) |
| 20 | +- [Improved Console Output for Swift Testing](2025-11-NN-swift-gsoc-2025-highlight-4-swift-testing-output.md) |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Improve the display of documentation during code completion in SourceKit-LSP |
| 25 | + |
| 26 | +Hi everyone! |
| 27 | + |
| 28 | +This is Ahmed Elrefaey, I’m excited to share with you an update on my GSoC project, Improve the display of documentation during code completion in SourceKit-LSP, mentored by Hamish Knight. |
| 29 | + |
| 30 | +### Project Goals |
| 31 | + |
| 32 | +The aim of this project is to enhance how documentation is displayed in SourceKit-LSP during code completion by: |
| 33 | + |
| 34 | +1. Showing the full documentation for a code completion item instead of the first paragraph only, which we call “brief documentation”. |
| 35 | +2. Implementing Language Server Protocol’s [signature help](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_signatureHelp) request showing the user which overloads are available, along with their corresponding documentation. |
| 36 | + |
| 37 | +### Progress |
| 38 | + |
| 39 | +During this summer, we have made great progress on this project that I want to share with you. |
| 40 | + |
| 41 | +We have successfully implemented full documentation comment retrieval for completion items by lazily retrieving the full documentation comment upon request to avoid having to fetch all documentation comments at once. |
| 42 | + |
| 43 | +Here’s what SourceKit-LSP currently provides in VS Code (brief documentation): |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +And here’s how it looks with full documentation: |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +We have also implemented a large portion of signature help support, showing the available overloads and their corresponding documentation while editing. |
| 52 | +We reused the existing argument completion logic to determine the overloads and refactored the code completion item description implementation to reuse it in signature help. |
| 53 | + |
| 54 | +Here’s a quick demo of signature help in VS Code. |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +### Closing Thoughts |
| 59 | + |
| 60 | +I'm incredibly grateful for this opportunity to contribute to the Swift project, and I really learned a lot from this experience. I'd like to thank my mentor, Hamish Knight, for his unwavering support and guidance throughout this summer. I’d also like to thank Alex Hoppen, Rintaro Ishizaki, and Ben Barham for their valuable feedback during code review. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +If you'd like to learn more about this project, please [check out the full post on the Swift forums](https://forums.swift.org/t/gsoc-2025-improve-the-display-of-documentation-during-code-completion-in-sourcekit-lsp/81976)! |
0 commit comments