diff --git a/_data/authors.yml b/_data/authors.yml index 2f5f411b7..e015125e0 100644 --- a/_data/authors.yml +++ b/_data/authors.yml @@ -560,6 +560,12 @@ mitchellallison: github: mitchellallison about: "Mitchell Allison works on Distributed Systems in Swift at Apple." +ahmedelrefaey: + name: Ahmed Elrefaey + email: a7med.mahmoud2004@gmail.com + github: a7medev + about: "Ahmed is a Google Summer of Code 2025 contributor, where he worked on improving the display of Swift documentation during code completion in SourceKit-LSP and VS Code." + priyambada: name: Priyambada Roul email: priyaroul99@gmail.com diff --git a/_posts/2025-11-12-swift-gsoc-2025-highlight-3-vscode-swift-lsp-documentation.md b/_posts/2025-11-12-swift-gsoc-2025-highlight-3-vscode-swift-lsp-documentation.md new file mode 100644 index 000000000..9a519457f --- /dev/null +++ b/_posts/2025-11-12-swift-gsoc-2025-highlight-3-vscode-swift-lsp-documentation.md @@ -0,0 +1,71 @@ +--- +layout: new-layouts/post +published: true +date: 2025-11-12 10:00:00 +title: "Swift GSoC 2025 highlight: Improve the display of documentation during code completion in SourceKit-LSP" +author: [ahmedelrefaey, hamish, ktoso] +category: "Developer Tools" +--- + +Another successful year of Swift participation in [Google Summer of Code](https://summerofcode.withgoogle.com) recently came to an end, and we'd like to shine some light on the projects and work accomplished! + +Summer of Code is an annual program, organized by Google, which provides hands-on experience for newcomers contributing +to open source projects. + +In this series of four blog posts, we'll highlight each of the Summer of Code contributors and their projects. +You can navigate between the posts using these convenient links: + + +- [Bringing Swiftly support to VS Code](2025-11-NN-swift-gsoc-2025-highlight-1-vscode-swiftly.md) +- [JNI mode for swift-java’s source jextract tool](2025-11-NN-swift-gsoc-2025-highlight-2-swift-java-jextract-jni-mode.md) +- Improve the display of documentation during code completion in SourceKit-LSP _(this post)_ +- Improved console output for Swift Testing _(coming soon)_ + +Each GSoC contributor has shared a writeup about their project and experience in the program on the forums. The first project we're featuring on the blog brought Swiftly support to Visual Studio Code, contributed by Priyambada Roul. +To learn more, you can read the [full post on the Swift forums](https://forums.swift.org/t/gsoc-2025-bringing-swiftly-support-to-vs-code/81886). + +Summer of Code is an annual program, organized by Google, which provides hands-on experience for newcomers contributing +to open source projects. Participants usually are students, but do not have to be. + +The third project we're featuring on the Swift blog improved how documentation is displayed by sourcekit-lsp and IDEs which make use of it, such as VS Code, contributed by Ahmed Elrefaey. To learn more, you can read 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)! + + +--- + +## Improve the display of documentation during code completion in SourceKit-LSP + +Hi everyone! + +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. + +### Project Goals + +The aim of this project is to enhance how documentation is displayed in SourceKit-LSP during code completion by: + +1. Showing the full documentation for a code completion item instead of the first paragraph only, which we call “brief documentation”. +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. + +### Progress + +During this summer, we have made great progress on this project that I want to share with you. + +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. + +Here’s what SourceKit-LSP currently provides in VS Code (brief documentation): + +![Brief documentation demo in VS Code.|690x412](/assets/images/gsoc-25/brief.gif) + +And here’s how it looks with full documentation: + +![Full documentation demo in VS Code.|690x412](/assets/images/gsoc-25/full.gif) + +We have also implemented a large portion of signature help support, showing the available overloads and their corresponding documentation while editing. +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. + +Here’s a quick demo of signature help in VS Code. + +![Signature help demo in VS Code|690x441](/assets/images/gsoc-25/output.gif) + +### Closing Thoughts + +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. diff --git a/assets/images/gsoc-25/brief.gif b/assets/images/gsoc-25/brief.gif new file mode 100644 index 000000000..124c334a2 Binary files /dev/null and b/assets/images/gsoc-25/brief.gif differ diff --git a/assets/images/gsoc-25/full.gif b/assets/images/gsoc-25/full.gif new file mode 100644 index 000000000..a460cf388 Binary files /dev/null and b/assets/images/gsoc-25/full.gif differ diff --git a/assets/images/gsoc-25/output.gif b/assets/images/gsoc-25/output.gif new file mode 100644 index 000000000..38b66f0aa Binary files /dev/null and b/assets/images/gsoc-25/output.gif differ