|
Just tested it in some different editors with some javascript because I care way too much about editors or something. Sublime Text 3 captures the independent 'i' correctly. Though it also picks it up in comments and strings. VS Code incorrectly highlighted all instances of the character 'i', even if it was part of another symbol. "Change All Occurrences" affected all instances of the character 'i'. Atom doesn't appear to have this feature without plugins (though someone should correct me if I'm wrong). IntelliJ and it's variants handled it perfectly, even understanding the actual variable, rather than just the symbol. "Rename All" would ask if I wanted to affect strings and comments, or just code (if there was an ' i ' in a string or comment, otherwise it wouldn't prompt), and it would only rename the variable within the correct scope. I tried it with both var and let. I would try more, but I think I'm wasting too much time, haha. But moreover, like others are saying, I can't think of a time where I've ever actually wanted to do that. Renaming all instances of a single letter variable? Generally the single letter is a very common convention I wouldn't change (i,j,k, u, x,y, _), or is in a very small, uncomplicated function where I wouldn't need a text editor's help to rename it because it only occurs once or twice. Anything more advanced than that gets a more verbose name that any of these editors could easily ctrl+F. |