Despite the name (and the misleading-at-first-glance "demo" on the home page), Lexical appears to be a rich text editor like Quill or ProseMirror, not a code editor.
You could definitely build a code editor with Lexical. There's already a lot of interest in the community to add plugins around Lexical to match that of ProseMirror. It might not be there right now, but the foundations that make it possible aren't missing.