I was using Typora, but now I use Zettlr. It's free for every desktop platform and open source.
You can even search multiple files in your directory from a sidebar while you type, it provides writing stats, has file tagging, exports to anything Pandoc supported, and it also has code highlighting.
Zettlr is so good. I'm pretty sure it's what you are looking for.
Seconding Zettlr. It also handles citations smoothly with a linked .bib file. The sidebar (a sidebar, there's more than one) also does directory tree structure like your favourite code editor too.