In the project explorer, click the 3-dot settings button (︙) go to Behaviour -> Always Select Opened File.