How did you configure your Air? (Ram and ssd?)For school programming classes, I think it is very highly likely that an M2 MBA would be more than sufficient. Also, the MBA is significantly more portable than a 14in MBP.
I would not recommend against the MBP because it is a great upgrade pick if you're willing to take the backpack weight gain. Given the performance of the M1 Pro/Max MBPs, it ought to last you well into your early post-collegiate days if you got it now. Additionally, the built in HDMI port is probably more useful for students than most might think. You won't have to keep a dongle around for presentation slide decks.
I've got a 16in M1 Max Macbook Pro for work and an M2 Macbook Air for personal (as of last Friday ha). They're both great computers. I love that the MBP can have a web, iOS, and Android app all running locally side by side along with a Remote Desktop session, Figma, and Pixelmator and it doesn't even get warm much less loud. I love that the MBA is lighter than a 12.9in iPad Pro + Magic Keyboard Case (my previous personal "laptop") but I could still pull down a repo and test one of my dev's projects in a pinch with no sweat.
Do you find the big difference is that the MBA can do the same tough stuff that the MBP can do almost as fast—but you just need to close everything else and let it run to avoid lag etc?
Whereas the MBP can do the tough stuff while you open 20 more tabs, a pdf, etc etc all at the same time?
(By tough stuff I mean like batch photo editing, video editing, your virtual desktops etc)