For large code development, I'd suggest using an IDE that supports it. AFAIK, there isn't one that works with notebooks, so this is sort of a half-answer: Someone has written a nice IDE for working with packages (".m"/".wl" files):
https://wlplugin.halirutan.de
There's also Wolfram Workbench.
You can save a .nb file to a .wl if you change all the input cells to be initialization cells; then Save As .wl. Can be a bit of a pain, though. Not sure if you can convert back to a .nb file.
Not a quick solution to your problem -- sorry about that.