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 heredoc delimiter documentation on hover #2617

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Conversation

vinistock
Copy link
Member

Motivation

Was chatting with @Schwad about how heredocs can be quite confusing for new developers. You wouldn't even know the right term to research in order to discover what they are.

We can improve the situation with a simple hover, explaining that it's a heredoc and showing the detected delimiter.

Implementation

Just started handling string nodes in hover. The delimiter extraction is the same as the one in on type formatting.

Automated Tests

Added a test.

@vinistock vinistock added enhancement New feature or request server This pull request should be included in the server gem's release notes labels Sep 24, 2024
@vinistock vinistock self-assigned this Sep 24, 2024
@vinistock vinistock requested a review from a team as a code owner September 24, 2024 21:46
Copy link
Contributor

@andyw8 andyw8 left a comment

Choose a reason for hiding this comment

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

A nice addition would be to explain the variants of <<~, <<-, etc.

@Schwad
Copy link
Contributor

Schwad commented Sep 25, 2024

A nice addition would be to explain the variants of <<~, <<-, etc.

And maybe '? though I know heredocs can be wiiiiild to match.

Thanks for chatting through this with me, @vinistock !! :D Would be great to help developers. That memory of heredoc confusion ~10 years ago still sticks with me!

Co-authored-by: Nick Schwaderer <Schwad@users.noreply.github.com>
@vinistock
Copy link
Member Author

A nice addition would be to explain the variants of <<~, <<-, etc.

Great idea! I added that for all three heredoc types (-, ~ and nothing).

@vinistock vinistock enabled auto-merge (squash) September 25, 2024 13:49
@vinistock vinistock merged commit b66d02a into main Sep 25, 2024
36 checks passed
@vinistock vinistock deleted the vs-add-heredoc-hover branch September 25, 2024 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants