Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the Expansion of Swift Macros in VS Code Blog Post of Google Summer of Code 2024 #824

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lokesh-tr
Copy link

This PR adds my Google Summer of Code 2024 work "Expansion of Swift Macros in Visual Studio Code" as a blog post.

(NOTE: I'm aware of the fact that there's a separate governance process for blog posts in swift.org website, and I believe this is something that my mentor and GSoC org admin will take care of, please read further to learn more)

Motivation:

Over the summer, I worked with my mentors, Alex Hoppen and Adam Fowler, on my Google Summer of Code 2024 Project known as "Expansion of Swift Macros in Visual Studio Code" and it was a success.

The time for having the annual Google Summer of Code summary blog post is coming soon. As per my mentor, @ahoppen , based on some internal discussions (which I believe happened between him, the GSoC Organisation Admin @ktoso and the other GSoC mentors), it seems like we are likely to have separate blog posts for each GSoC project this year instead of a summary blog post. (I'm not very certain of the specifics)

And as suggested by my mentor @ahoppen , here I made this PR that adds my GSoC work as a blog post to the swift.org website.

Modifications:

  • Added a blog post in _posts folder.
  • Added the necessary image files in the assets/images/expansion-of-swift-macros-in-vscode-blog folder.
  • Updated the authors.yml file to have details about me (the author of this blog post).
  • NOTE: I'm not sure what the date will be, so I kept a dummy date and added a bold comment as a reminder to update the date.
  • ALSO NOTE: This PR is not to be merged (yet).

Result:

A new blog post will appear in the blog page. Clicking Read More... will lead to the full blog post. This blog post will talk about my work which I did over the summer with my mentors which is "Expansion of Swift Macros in Visual Studio Code"

cc @ahoppen @adam-fowler

Please let me know if you have any suggestions to this blog post (I did very few minor changes from the swift forums post). Also, let me know if I overlooked any details or the coding standards / conventions of this repository.

_data/authors.yml Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
@lokesh-tr lokesh-tr force-pushed the gsoc24-expansion-of-swift-macros-in-vscode branch from 381d0ac to 5be9b00 Compare October 11, 2024 16:36
@lokesh-tr
Copy link
Author

@ahoppen I have addressed your review comments and made some minor changes. Let me know if you get any suggestions

@lokesh-tr lokesh-tr requested a review from ahoppen October 11, 2024 16:38
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I just have a few minor comments. @ktoso When do you want to schedule this blog post to be released?

_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
_posts/2030-12-28-expansion-of-swift-macros-in-vscode.md Outdated Show resolved Hide resolved
Copy link
Contributor

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good


Over the summer, we worked on adding support for expansion of Swift Macros in Visual Studio Code. Our project's main goal is to implement a code action in VS Code that allows users to view the generated contents of a Swift Macro.

Here's what it looks like to show the generated contents of a Swift Macro in a peeked editor when the "Expand Macro" Code Action is invoked by the user:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"peeked editor?" Maybe change to more common terminology

![Expand Macro Code Action in VS Code](/assets/images/expansion-of-swift-macros-in-vscode-blog/expand-macro-code-action.jpeg)
![Macro Expansion in Peeked Editor](/assets/images/expansion-of-swift-macros-in-vscode-blog/macro-expansion-in-peeked-editor.jpeg)

There were also some stretch goals which include:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include -> included

There were also some stretch goals which include:

1. Bringing Semantic Functionality (such as jump-to-defintion, quick help on hover, Syntax Highlighting, etc.) to the macro expansion being previewed.
2. Allowing to perform the "Expand Macro" Code Action on a macro that is present in the generated macro expansion to support the expansion of nested macros.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps better as "Allowing the "Expand Macro" Code Action on a nested macro that is present in the generated macro expansion"


### When can you start using this feature?

This will be available with SourceKit-LSP bundled with **Swift 6.1 and the corresponding VS Code Swift Extension Release**. For the curious minds, This feature is available in the `main` branch of `sourcekit-lsp` and `vscode-swift` repositories, right now.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the curious minds, This feature -> the curious, this feature
branch of -> branch of the


### Main Goal

In order to achieve the main goal, we introduced two new LSP extensions and new custom URL scheme as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extensions and new -> extensions and a new


#### Working of the "Expand Macro" Code Action

1. The `"workspace/peekDocuments"` request is sent from SourceKit-LSP to the editor and prompts it to show the the contents of `locations` inside the source file `uri` as a peek window at `position`. In VS Code, this executes the `"editor.action.peekLocations"` command to present a peeked editor.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

show the the contents -> show the contents

Maybe define the term "peeked editor" at the beginning if you want to use the term in this post.

Copy link
Contributor

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for preparing the post @lokesh-tr!

I'm discussing with relevant folks about schedule of publishing those. We may need a moment to figure it out, but I'm sure we'll get it published soon enough - thank you! We may need to prepare the other posts and then do a week of GSoC posts of something like that...

I proposed some minor things and we'd add a section about "what is GSoC" etc. But you don't have to immediately address those, let's give me a moment to figure out the schedule.


`/* DUMMY DATE TO BE CHANGED BEFORE PR MERGE */` We're excited to announce that, with Swift 6.1, you can finally view the generated contents of a Swift Macro in Visual Studio Code and other LSP-based editors such as Neovim using the all-new "Expand Macro" Code Action.

I'm Lokesh T. R. from India. I'm a sophomore currently pursuing my bachelor's degree in Computer Science and Engineering at Vel Tech University in Chennai. I'm thrilled to share with you, my Google Summer of Code 2024 Project which I worked on with my mentors, Alex Hoppen and Adam Fowler.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "about the author" is already taken from the authors.yml so this is a bit repeating the same 🤔

author: [lokeshtr, ahoppen, adam-fowler]
---

`/* DUMMY DATE TO BE CHANGED BEFORE PR MERGE */` We're excited to announce that, with Swift 6.1, you can finally view the generated contents of a Swift Macro in Visual Studio Code and other LSP-based editors such as Neovim using the all-new "Expand Macro" Code Action.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`/* DUMMY DATE TO BE CHANGED BEFORE PR MERGE */` We're excited to announce that, with Swift 6.1, you can finally view the generated contents of a Swift Macro in Visual Studio Code and other LSP-based editors such as Neovim using the all-new "Expand Macro" Code Action.
## Swift Google Summer of Code Projects
Sift regularly participates in [Google Summer of Code](https://summerofcode.withgoogle.com/) in order to help people new to the open source ecosystem dip their toes in contributing to Swift and its growing ecosystem.
During the 2024 edition of the program, we ran four projects, all of which completed their assigned projects successfully. This year's projects were:
- Expansion of Swift Macros in Visual Studio Code
- Lexical scopes for swift-syntax
- Swift-etcd: A Native Client for Seamless Integration with etcd Servers
- Swift code generator to support the creation of SAM deployment descriptor
We’d like to extend our sincere thanks to the participants and mentors who poured their time and passion into these projects, and use this post to highlight their work to the wider community.
In this small series of blog posts we'd like to highlight some of the projects.
## Expansion of Swift Macros in Visual Studio Code
`/* DUMMY DATE TO BE CHANGED BEFORE PR MERGE */` We're excited to announce that, with Swift 6.1, you can finally view the generated contents of a Swift Macro in Visual Studio Code and other LSP-based editors such as Neovim using the all-new "Expand Macro" Code Action.


I'm Lokesh T. R. from India. I'm a sophomore currently pursuing my bachelor's degree in Computer Science and Engineering at Vel Tech University in Chennai. I'm thrilled to share with you, my Google Summer of Code 2024 Project which I worked on with my mentors, Alex Hoppen and Adam Fowler.

## Overview
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Overview
### Overview

![Expand Macro Code Action in other LSP-based editors (Neovim)](/assets/images/expansion-of-swift-macros-in-vscode-blog/expand-macro-code-action-in-other-lsp-based-editors-neovim.jpeg)
![Macro Expansion in other LSP-based editors (Neovim)](/assets/images/expansion-of-swift-macros-in-vscode-blog/macro-expansion-in-other-lsp-based-editors-neovim.jpeg)

### When can you start using this feature?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### When can you start using this feature?
#### When can you start using this feature?


This will be available with SourceKit-LSP bundled with **Swift 6.1 and the corresponding VS Code Swift Extension Release**. For the curious minds, This feature is available in the `main` branch of `sourcekit-lsp` and `vscode-swift` repositories, right now.

## Implementation Details
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Implementation Details
### Implementation Details


## Implementation Details

### How Swift Language Features work in LSP-based editors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### How Swift Language Features work in LSP-based editors
#### How Swift Language Features work in LSP-based editors

- provides the raw data and operations to SourceKit-LSP
- shares implementation details with the Swift compiler

### Main Goal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Main Goal
#### Main Goal

@lokesh-tr
Copy link
Author

@ktoso

Thank you very much for preparing the post @lokesh-tr!

Thank you so much for having detailed blog posts unlike the previous years!

I'm discussing with relevant folks about schedule of publishing those. We may need a moment to figure it out, but I'm sure we'll get it published soon enough - thank you!

Sure, Please do take your time for organising the schedule.

We may need to prepare the other posts and then do a week of GSoC posts of something like that...

That makes, sense.

I proposed some minor things and we'd add a section about "what is GSoC" etc. But you don't have to immediately address those, let's give me a moment to figure out the schedule.

Please do take your time and once things are sorted out, just wave me a green flag, then I will address all of your comments. Alright?

@lokesh-tr
Copy link
Author

Thanks for the review @finagolfin , I will address your comments in my next commit along with Konrad's comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants