I was on the same boat many years ago, when I co-founded Monodevelop, a port of #SharpDevelop to Mono. I started by porting the text component, which was the core of the text editor itself.
There was a book explaining the implementation of this IDE:
https://www.amazon.com/Dissecting-C-Application-Inside-Sharp...
I think you might find it interesting for what you are trying to do, even though it's a bit old.