When you have something like:
Product2 site = new Product2(Name = 'Test_Name', ProductName=);
You’ve gotten to the end of the string and you now want to extract ‘Test_Name’ as a variable and assign it to ProductName. Now the line itself is now incorrectly formed as the
ProductName= isn’t complete.
If you select ‘Test_Name’ and extract what happens is actually this:
Product2 site = new Product2(Name = String str = 'Test_Ttest'; 'Test_Ttest', ProductCode=);
What I would expect is this:
String str = 'Test_Ttest'; Product2 site = new Product2(Name = str, ProductCode=);
Funny thing is if you do it without the '=' i.e.
Product2 site = new Product2(Name = 'Test_Name', ProductName);
very much an edge case. Not too bothered but thought I should list it.