Fix: Block parameters prefixed with underscore are incorrectly highlighted #2972
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 progressManual Tests
With changes
![with changes](https://private-user-images.githubusercontent.com/60617358/394896018-49501559-7e45-44cd-980b-fa26b73990c1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NzI4NzgsIm5iZiI6MTczODg3MjU3OCwicGF0aCI6Ii82MDYxNzM1OC8zOTQ4OTYwMTgtNDk1MDE1NTktN2U0NS00NGNkLTk4MGItZmEyNmI3Mzk5MGMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDIwMDkzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI0MTBmNWU2OWRlOGE4MzhiN2E3OTA5MzdjNDU3NzRjOTc0NmJkNmY2MDRjMTViOGZhMTc5YzdkMDk5ZTc2NzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.g62rVPspJTeJDQbM6Q1Qo2jyDx6v-YbKTuc0nQYTxx0)
ges:
Without changes:
![without changes](https://private-user-images.githubusercontent.com/60617358/394895982-183821c0-42ca-413b-a3db-23f3fb738bd3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4NzI4NzgsIm5iZiI6MTczODg3MjU3OCwicGF0aCI6Ii82MDYxNzM1OC8zOTQ4OTU5ODItMTgzODIxYzAtNDJjYS00MTNiLWEzZGItMjNmM2ZiNzM4YmQzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDIwMDkzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU5YTUxYTA0MmU5MGQyNTUwYWFjNmQ5MDZkYmUxNjgyM2NmM2U0NDNkM2IwMWM2ZDFiYTVlMmM1NjE0YTRlODAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.h4sahMq6-JRTkinK3KvpruMSGRXdVP1WnSAUwn4I2pA)