Skip to content

Commit 7d30548

Browse files
ktosotienquocbuia7medevhamishknight
committed
Apply suggestions from code review
Co-authored-by: Kelvin Bui <[email protected]> Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: Hamish Knight <[email protected]> Co-authored-by: Kelvin Bui <[email protected]>
1 parent cd5789e commit 7d30548

5 files changed

+28
-18
lines changed

_data/authors.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,23 +555,23 @@ mitchellallison:
555555
mads:
556556
name: Mads Odgaard
557557
558-
github: https://github.com/madsodgaard
558+
github: madsodgaard
559559
about: Mads is a Google Summer of Code 2025 contributor, where he worked on bringing JNI support to the jextract tool which is part of the Swift Java interoperability project.
560560

561561
ahmedelrefaey:
562562
name: Ahmed Elrefaey
563-
email:
564-
github: https://github.com/a7medev
565-
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 VSCode.
563+
564+
github: a7medev
565+
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.
566566

567-
tien:
568-
name: Kelvin Bui
567+
kelvin:
568+
name: Tien Quoc (Kelvin) Bui
569569
570-
github: https://github.com/tienquocbui
570+
github: tienquocbui
571571
about: Kelvin is a Google Summer of Code 2025 code contributor, where he worked on improving the console output for Swift Testing.
572572

573573
priyambada:
574574
name: Priyambada Roul
575575
576-
github: https://github.com/roulpriya
576+
github: roulpriya
577577
about: Priyambada is a Google Summer of Code 2025 code contributor, where she worked on providing Swiftly support in VSCode.

_posts/2025-11-NN-swift-gsoc-2024-highlight-1-vscode-swiftly.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ I have linked all pull requests and technical details in my **[detailed project
9393

9494
This GSoC experience has been transformative. I came in as someone intimidated by large codebases, and I'm leaving with the confidence to tackle complex, multi-tool integrations. I'm excited to continue contributing to Swift community!
9595

96-
Thank you.
9796

9897
---
9998

_posts/2025-11-NN-swift-gsoc-2024-highlight-2-swift-java-jextract-jni-mode.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ This concept also exists in the FFM mode, and I recommend watching Konrad’s ta
111111
112112
If we take a look at the native implementation of `$init` in Swift, we see how we allocate and initialize the memory:
113113
```swift
114+
// Generated code, not something you would write
115+
114116
@_cdecl("Java_com_example_swift_MySwiftClass__00024init__JJ")
115117
func Java_com_example_swift_MySwiftClass__00024init__JJ(environment: UnsafeMutablePointer<JNIEnv?>!, thisClass: jclass, x: jlong, y: jlong) -> jlong {
116118
let result$ = UnsafeMutablePointer<MySwiftClass>.allocate(capacity: 1)

_posts/2025-11-NN-swift-gsoc-2024-highlight-3-vscode-swift-lsp-documentation.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,14 @@ This is Ahmed Elrefaey, I’m excited to share with you an update on my GSoC pro
3131

3232
The aim of this project is to enhance how documentation is displayed in SourceKit-LSP during code completion by:
3333

34-
1. Showing the full documentation for a code completion item instead of the first paragraph only which we call “brief documentation”.
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.
3536

36-
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.
37-
38-
### Progress**
37+
### Progress
3938

4039
During this summer, we have made great progress on this project that I want to share with you.
4140

42-
We have successfully implemented full documentation comment retrieval for completion items. We went with a lazy approach that retrieves the full documentation comment upon request to avoid having to compute all comments and cache them at once which will require a lot of time and memory. This involved making Swift declarations round-trippable to be able to restore them for cached completion items and retrieve the documentation comment.
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.
4342

4443
Here’s what SourceKit-LSP currently provides in VS Code (brief documentation):
4544

@@ -57,13 +56,23 @@ Here’s a quick demo of signature help in VS Code.
5756

5857
### Challenges
5958

60-
One of the interesting challenges we faced was reconstructing a declaration from its USR in order to retrieve full documentation comments for cached completion items. The challenging part is that there are many types of declarations (e.g. functions, properties, classes, etc), the most important distinction is Swift declarations vs. Clang-imported declarations. There are also different types of declaration contexts (e.g. a declaration might be declared as a top-level module item, or as a member of a nominal type declaration like a struct). And modules can be synthesized by the compiler or they can be regular modules. We needed to account for all such cases when implementing USR to declaration reconstruction.
59+
#### Retrieving declarations for cached completion items
60+
61+
An interesting challenge we faced with full documentation comment retrieval in code completion was retrieving the comment for cached code completion items. We use the completion item's associated declaration to get the comment, but some completion items can be cached, and we can't cache their associated declarations.
62+
63+
To tackle this issue, we cache the declaration's Swift Unified Symbol Resolution (USR), which is a string that identifies a declaration, and then we use it to look up the declaration when we need to fetch its documentation comment.
64+
65+
The challenging part is that there are many types of declarations (e.g., functions, properties, classes). Some declarations are defined in Swift, others are imported from languages like Objective-C and C++, which are imported through Clang. There are also different types of declaration contexts (e.g., a declaration can be a top-level module item, a member of a struct, etc). And modules can be synthesized by the compiler, or they can be regular modules. We needed to account for all such cases when implementing the USR-to-declaration lookup.
66+
67+
#### Conflicting USRs for Clang-imported declarations
68+
69+
Another challenge we faced was an issue where a declaration imported through Clang (e.g., a declaration defined in Objective-C) and a compatibility type-alias for it had the same USR, which broke the assumption about a USR being unique to a specific declaration, making the USR-to-declaration lookup logic fail in some cases.
6170

62-
Another interesting challenge we faced was an issue where a Clang-imported declaration and a compatibility type-alias for it produce the same USR. This breaks the assumption that a USR is unique to a certain declaration and would result in declaration reconstruction tests failing due to non-matching declarations (e.g. the original was for the actual declaration but the one returned was for a type-alias). We fixed this issue by changing the mangling for compatibility type-aliases to be mangled as a ClangImporter-synthesized declaration with the USR containing the its Swift-exposed name disambiguating the USR for the actual declaration vs. for a type-alias.
71+
To fix this, we changed the mangling for compatibility type-aliases to use their Swift-exposed names, disambiguating the USR for the actual declaration vs. for a type-alias.
6372

6473
### Closing Thoughts
6574

66-
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 @hamishknight for his unwavering support and guidance throughout this summer. I’d also like to thank @ahoppen, @rintaro, and @bnbarham for their valuable feedback during code review.
75+
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.
6776

6877
---
6978

_posts/2025-11-NN-swift-gsoc-2024-highlight-4-swift-testing-output.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In this series of four posts, we'll highlight each of the Summer of Code contrib
2323

2424
## Improved Console Output for Swift Testing
2525

26-
Hello everyone! My name is Kelvin Bui, and I'm excited to share my GSoC 2025 project, where I worked on improving the console output for the Swift Testing framework with my mentor, @smontgomery.
26+
Hello everyone! My name is Kelvin Bui, and I'm excited to share my GSoC 2025 project, where I worked on improving the console output for the Swift Testing framework with my mentor, @stmontgomery.
2727

2828
### Overview
2929

0 commit comments

Comments
 (0)