Fork me on GitHub

Looking for resources for designing a source code editor. Are there any general principles that apply or are the implementations and architecture always platform dependent?


Looking for relevant research papers, books, etc. I know there are multiple open source editors but before I start scanning them, I would like to know if there are any general principles that all code editors share? For say syntax highlighting, indexing the code, cursor and selection handling and so on.


Multiple buffers is smart (Emacs) Syntax highlighting... yeah that's an important one. Emacs also has the "undo tree" which is amazing and you can walk through code changes in a tree-like fashion. Directory/file viewer... Ability to know when a file is changed from the on-disk copy...


deal breaker: there should never be a way of losing any significant amount of work, even if your power suddenly goes out (so you need some kind of incremental / auotmatic backup scheme). there are great editors that I would use except I refuse to use an editor that doesn't prevent losing my work.


we shouldn't have to explicitly save our files for any reason other than trying out new code - everything else should be implicitly managed by the editor between explicit saves


Not sure what you mean by platform dependent, but I think most source code editors run on multiple platforms

phronmophobic18:06:00 is also worth checking out. It's written in javascript, but it's written in a fairly functional style.


Thanks @U7RJTCH6J, I’m aware of Codemirror and it’s sibling Prosemirror (I work with prosemirror at work). Prosemirror’s API and design seem fairly generic and platform agnostic, by which I mean, the EditorState and EditorView abstractions can serialise to possibly other formats than HTML. What I’m interested is in knowing if there is a “standard” way to go about designing code editors.


I needed to make a code-editor component for my UI library and from what I could tell, the "standard" way is to start with codemirror/intelliJ and go from there


Hmm, I want to employ the Apple Pencil, the API for which is only available via Swift/ObjC. So JS/Java runtimes are ruled out :/


I'm not sure I'd recommend it, but it's at least possible to run JS/JVM code on mobile and interop with ObjC


CotEditor is the only decent starting point in the Swift land


Yeah even if I could patch the runtimes somehow, the performance and user experience will be very much degraded


Darn, using the apple pencil would be pretty awesome. Are you sure there's no way to get it in Java land?


Yeah editing lisp code with Apple Pencil will feel really natural I think. A sneak peak of my pondering.

😮 2

The Apple Pencil experience is really smooth, I’m afraid it demands a native runtime for a highly quality experience.


fwiw, I was recently able to compile clojure with graalvm native image to run on my iPhone including evaling clojure code with sci.


for your lisp editor, how would you input code, normal keyboard or did you have something else in mind?


Yeah I did follow those conversations and I’m really excited about it. Embedding a Clojureish runtime in iOS is very exciting. I really hope it becomes a thing since I don’t want to compile Clojure code remotely from my iPad, if this editor ever takes any shape.


The lofty goal is to input everything from the Pencil. Apple has this scribble API for OCR which is good, but doesn’t recognise symbols yet but that could be tackled via the raw pencil input I think.

🤯 4

PSA: if you don't enjoy telling someone else what to type during Agile Story Grooming/Refinement, please vote for this jira issue