|
|
|
|
|
by rstat1
1581 days ago
|
|
I believe VSCode's editor is actually built on a variation of a piece table (they call it a piece tree) https://code.visualstudio.com/blogs/2018/03/23/text-buffer-r... Not sure if this is still the case, but it was as of 2018. Its really kind of fascinating to me, all the different ways we've come up with over the years just to manipulate text. |
|
One of the things that strikes me is how much effort goes into making these editors work well with absurdly large files, rather than more editors punting on that and having people fall back on specific tools for huge files.
For my own editor I basically decided to ignore large files entirely and fall back on using emacs for the very rare case where I need to open an absurdly large file.
I know that's a luxury Jetbrains doesn't have, because we've come to expect all editors to handle ridiculous sized files well.
But the point being that for reasonably sized files - up to tens of thousands of lines - just an array of strings is more than fast enough.
Even with an editor like my personal one (not really usable for anyone else, though I've started packaging up parts of the code) written in Ruby (which introduces a substantial overhead per string).
I think if I ever decide to make my editor handle really huge files, I'll "just" split them in suitably large chunks and lazily do the necessary processing as needed