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

Block parameters prefixed with underscore are incorrectly highlighted #2837

Open
vinistock opened this issue Nov 6, 2024 · 4 comments
Open
Labels
bug Something isn't working good-first-issue Good for newcomers vscode This pull request should be included in the VS Code extension's release notes

Comments

@vinistock
Copy link
Member

Our grammar file is not properly handling block parameters that are prefixed with underscore. For example:

# `a` looks ok
# `b` doesn't
[].each do |a, _b|
end

We might be missing _ as a valid character in the regex.

@vinistock vinistock added bug Something isn't working good-first-issue Good for newcomers vscode This pull request should be included in the VS Code extension's release notes labels Nov 6, 2024
@pepetorres1998
Copy link

Can I work on this issue?

@vinistock
Copy link
Member Author

Sure!

@andyw8
Copy link
Contributor

andyw8 commented Nov 18, 2024

(I don't mind if we do this, but I wonder if this was originally an intentional decision due to the _prefix indicating an unused variable.).

@vinistock
Copy link
Member Author

It cannot have been intentional, because it currently assigns the constant token to them. Additionally, the leading underscore it's just a convention. From Ruby's perspective, it's still a parameter and even referring to it still works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good-first-issue Good for newcomers vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

No branches or pull requests

3 participants