Case-sensitive multiselect in VS Code

When I use multiselect (aka multiple cursor selection) in VS Code via Cmd+D (which is constantly), I usually prefer case-sensitive behavior when refactoring and finding things I can edit in-place at once. When I search via Cmd+F, I often prefer case-insensitive behavior as I’m looking for logic related to a word (could be a foo_bar or FooBar and I want Cmd+F, foo to find both).

It took me awhile to figure out how to get multiselect to behave the way I want regarding case in VS Code.

case

If you Cmd+F and toggle case sensitivity by clicking the “Aa” icon (shown above), then multiselect via Cmd+D will obey the same rule as search via Cmd+F. But that’s an inefficient pattern for on-the-fly toggling for multiselection.

HOWEVER, it turns out you can also toggle this setting when editing by issuing Option+Cmd+C, although there will be no visual cue that anything has happened unless you have the search modal open and can see the “Aa” icon toggle on/off.

This is hard to remember, but it works. Both actions toggle the variable toogleFindCaseSensitive (not a typo) under the hood.

You can read more about me, follow me on Twitter, subscribe to this blog by RSS or email, and find many more posts in the archives.