Fork me on GitHub
#off-topic
<
2021-06-30
>
indy18:06:12

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?

indy18:06:45

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.

sova-soars-the-sora18:06:27

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...

noisesmith22:06:02

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.

3
noisesmith22:06:32

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

phronmophobic18:06:08

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

phronmophobic18:06:00

https://codemirror.net/ is also worth checking out. It's written in javascript, but it's written in a fairly functional style.

indy18:06:28

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.

phronmophobic18:06:40

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

indy18:06:08

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 :/

phronmophobic18:06:58

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

indy18:06:18

CotEditor is the only decent starting point in the Swift land

indy18:06:50

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

sova-soars-the-sora18:06:31

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

indy18:06:55

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

😮 2
indy18:06:10

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

phronmophobic18:06:28

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

phronmophobic18:06:37

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

indy18:06:22

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.

indy19:06:26

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
antonmos19:06:13

PSA: if you don't enjoy telling someone else what to type during Agile Story Grooming/Refinement, please vote for this jira issue https://jira.atlassian.com/browse/JRACLOUD-73885