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

Fix: Block parameters prefixed with underscore are incorrectly highlighted #2972

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

willyamacaroni
Copy link
Contributor

@willyamacaroni willyamacaroni commented Dec 11, 2024

Motivation

#2837

What:
Removes the distinction between block variables prefixed with underscore and those not prefixed with underscore.

Why:
As per the github issue: the leading underscore is just a convention. From Ruby's perspective, it's still a parameter and even referring to it still works.

Implementation

The regex was making 3 capture groups, one of which was specifically for variables prefixed with an underescore. I removed that group and modified the other variable group to include the underscore prefix.

Automated Tests

I saw there was grammars.test.ts but I'm running into a lot of errors trying to run the tests. It's a work in progress

Manual Tests

With changes
with changes
ges:

Without changes:
without changes

What:
Removes the distinction between block variables prefixed with underscore
and those not prefixed with underscore.

Why:
As per the github issue: the leading underscore is just a convention.
From Ruby's perspective, it's still a parameter and even referring to it
still works.
@willyamacaroni
Copy link
Contributor Author

image

@willyamacaroni willyamacaroni marked this pull request as ready for review December 11, 2024 20:24
@willyamacaroni willyamacaroni requested a review from a team as a code owner December 11, 2024 20:24
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

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

Thanks!

@vinistock vinistock added bugfix This PR will fix an existing bug vscode This pull request should be included in the VS Code extension's release notes labels Dec 12, 2024
@vinistock vinistock merged commit 692b55a into main Dec 12, 2024
37 checks passed
@vinistock vinistock deleted the willyam-fix-block-params-prefixed-with-underscore branch December 12, 2024 17:53
@andyw8 andyw8 changed the title Github issue: https://github.com/Shopify/ruby-lsp/issues/2837 Fix: Block parameters prefixed with underscore are incorrectly highlighted Dec 20, 2024
@andyw8
Copy link
Contributor

andyw8 commented Dec 20, 2024

(I changed the PR title so the changelog for the next release is easier to read)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants