Skip to content

Commit 45de73a

Browse files
authored
[GSoC-2025] Blog post 3: Improve the display of documentation during code completion in SourceKit-LSP (#1212)
1 parent 9ce40d9 commit 45de73a

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

_data/authors.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,11 +560,17 @@ mitchellallison:
560560
github: mitchellallison
561561
about: "Mitchell Allison works on Distributed Systems in Swift at Apple."
562562

563+
ahmedelrefaey:
564+
name: Ahmed Elrefaey
565+
566+
github: a7medev
567+
about: "Ahmed is a software developer at Luciq. During Google Summer of Code 2025, he worked on improving the display of Swift documentation during code completion in SourceKit-LSP and VS Code."
568+
563569
mads:
564570
name: Mads Odgaard
565571
566572
github: madsodgaard
567-
about: Mads is a Tech Lead at Frameo. During Google Summer of Code 2025, he worked on bringing JNI support to the jextract tool which is part of the Swift Java interoperability project.
573+
about: "Mads is a Tech Lead at Frameo. During Google Summer of Code 2025, he worked on bringing JNI support to the jextract tool which is part of the Swift Java interoperability project."
568574

569575
priyambada:
570576
name: Priyambada Roul
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
layout: new-layouts/post
3+
published: true
4+
date: 2025-11-12 17:05:00
5+
title: "Swift GSoC 2025 highlight: Improved code completion for Swift"
6+
author: [ahmedelrefaey, hamish, ktoso]
7+
category: "Developer Tools"
8+
---
9+
10+
Our blog post series showcasing the Swift community’s participation in [Google Summer of Code](https://summerofcode.withgoogle.com) 2025 continues with our third update. Learn more about the projects and work accomplished:
11+
12+
- [Bringing Swiftly support to VS Code](/blog/gsoc-2025-showcase-swiftly-support-in-vscode/)
13+
- [Extending Swift-Java Interoperability](/blog/gsoc-2025-showcase-swift-java/)
14+
- Improved code completion for Swift _(this post)_
15+
- Improved console output for Swift Testing _(coming soon)_
16+
17+
Each GSoC contributor has shared a writeup about their project and experience in the program on the forums. Today’s featured project improved how documentation is displayed during code completion in IDEs, contributed by Ahmed Elrefaey.
18+
19+
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)!
20+
21+
The project enhances SourceKit-LSP, an implementation of the Language Server Protocol (LSP) for Swift and C-based languages. Now you can see full documentation during code completion instead of just brief summaries, as well as what arguments are available to pass when calling functions.
22+
23+
Editors that support the Language Server Protocol all benefit from these improvements to SourceKit-LSP, bringing these features to editors like VS Code, Neovim, IntelliJ IDEA, Vim, and more.
24+
25+
This work has landed in the SourceKit-LSP project, and will be included in a future Swift toolchain release.
26+
27+
---
28+
29+
## Improve the display of documentation during code completion in SourceKit-LSP
30+
31+
Hi everyone!
32+
33+
This is Ahmed Elrefaey. I’m excited to share with you an update on my GSoC project which improved the display of documentation during code completion for Swift. I worked on improvements to [SourceKit-LSP](https://github.com/swiftlang/sourcekit-lsp), which is an implementation of the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP) for Swift and C-based languages. My GSoC project was mentored by Hamish Knight.
34+
35+
### Project Goals
36+
37+
The aim of this project is to enhance how documentation is displayed in SourceKit-LSP during code completion by:
38+
39+
1. Showing the full documentation for a code completion item instead of the first paragraph only, which we call “brief documentation”.
40+
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.
41+
42+
### Progress
43+
44+
During this summer, we have made great progress on this project that I want to share with you.
45+
46+
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.
47+
48+
Here’s what SourceKit-LSP currently provides in VS Code (brief documentation):
49+
50+
![Brief documentation demo in VS Code.|690x412](/assets/images/gsoc-25/brief.gif)
51+
And here’s how it looks with full documentation:
52+
53+
![Full documentation demo in VS Code.|690x412](/assets/images/gsoc-25/full.gif)
54+
We have also implemented a large portion of signature help support, showing the available overloads and their corresponding documentation while editing.
55+
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.
56+
57+
Here’s a quick demo of signature help in VS Code.
58+
59+
![Signature help demo in VS Code.|690x441](/assets/images/gsoc-25/output.gif)
60+
To try this out in VS Code for yourself, you can [download a main development snapshot from swift.org](https://swift.org/download). If using Swiftly you can run `swiftly install main-snapshot`. Then, in VS Code you can pick "Select Toolchain" from the Command Palette and select the newly downloaded toolchain.
61+
62+
### Closing Thoughts
63+
64+
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.

assets/images/gsoc-25/brief.gif

1.53 MB
Loading

assets/images/gsoc-25/full.gif

3.12 MB
Loading

assets/images/gsoc-25/output.gif

4.34 MB
Loading

0 commit comments

Comments
 (0)