This study will look at the long-term effects of semaglutide (active medicine) on diabetic eye disease when compared to placebo (dummy medicine). The study will be performed in people with type 2 diabetes. Participants will either get semaglutide or placebo in addition to their diabetes medicines - which treatment the participant gets is decided by chance. Participants will inject the study medicine using a pen-injector. The medicine must be injected in a skin fold in the stomach, thigh or upper arm once a week. The study will last for 5 years.