4 ms·
That's great! Does anyone know if the code editor itself uses canvas rendering? If not then why?
by polskibus 9y ago
That's great! Does anyone know if the code editor itself uses canvas rendering? If not then why?
- altano 9y agoIt doesn’t use canvas
- copperx 9y agoHaving never looked at the source, I'm curious about how you build an editor using web technologies. Is it just a big textarea that gets manipulated with JS?
- simlevesque 9y agoIt's not one large textarea. There is a textarea which is 1x1 and right next to the cursor. I have no idea what they are for. Just open the dev tools and have some fun. You'll learn a lot.
- lobster_johnson 9y agoThe textarea is to accept input, presumably. It's a trick often used in a normal browser HTML page, too. You get focus, keypresses, copy/paste, etc. via the native browser UI. It's a shame that HTML doesn't provide something similar, but as a hack it's not too bad.
- simlevesque 9y agoThe other comment is wrong. I opened the DevTools inside vscode and executed 'document.getElementsByTagName("canvas")'. In a single editor group[1] in edit mode there are two canvases. One is for the overview over the scroll bar. The second is the minimap. When you are in diff mode there are two more canvases to show the diff on the right side. [1] https://code.visualstudio.com/docs/getstarted/userinterface#_editor-groups https://code.visualstudio.com/docs/getstarted/userinterface#...