-
Notifications
You must be signed in to change notification settings - Fork 172
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 conditional local var highlight #2719
Fix conditional local var highlight #2719
Conversation
…tion assignment in conditions
I have signed the CLA! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. Can we also add the other forms of assignment? This is adding regular assignment and assignment operator. We are missing local variable and assignment and local variable or assignment. E.g.:
if (a ||= something)
end
if (a &&= something)
end
…tion assignment in conditions
…d operation and/or assignment in conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution!
Motivation
Closes #2690
This PR address the issue where syntax highlighting was not applied to syntax that assigns variables within conditions, such as
if (a=1)
.Implementation
if
,elsif
,unless
,until
, andwhile
statements.+=
,-=
,*=
,/=
, and%=
are also supported in the same manner.case (x = foo)
if (x = foo)
elsif (x = foo)
unless (x = foo)
until (x = foo)
while (x = foo)
for i in (x = 1..10)
begin (x = foo)
rescue (x = foo)
else (x = foo)
ensure (x = foo)
Automated Tests
Added three cases to check
if(i=1)
,if(i+=1)
andif(i&&=1)
Manual Tests