Complete examples using Codemirror 6

Hello, I’m very excited about all the work happening here in Codemirror6!

One problem that I’m having is that I’m finding it quite hard to see complete examples on how to use Codemirror 6. The examples section on the website doesn’t show the source code, and also, on the documentation, I barely see any examples. The guides have code, but only in fragments.

As pointed out by Mike Bostock (D3 Author) in this recent excellent post, teaching is fundamental, and examples go a long way. Saying in short, if you give me a code example, I can read it and figure out the pieces, navigate to sources, I can learn from them. But when it’s just text, I have to guess what API’s the writer is talking about and how do I connect these pieces, all of which are present in examples but hardly on the text description.

I think this should also be considered when replying to messages here. Giving full examples is a great way to answer a question when possible. For instance, I’m currently trying to figure out how to place an editor and sync some React state. This, to me, sounds like a straightforward operation. I should listen to some events and extract the new text to put somewhere else. I found this topic here CodeMirror 6: Proper way to listen for changes - #9 by raldone01 with a discussion around that, but a lot of posts and no full example. It’s probably straightforward for someone familiar with CM6, but it’s not for someone just starting on CM6.

If there are examples somewhere and I didn’t found, sorry for the big text, I would love to know where to find those!

Those with relevant source code do show the code right there in the examples, so the fact that you’re starting with this makes me wonder how much time you took looking at the actual examples before coming here to complain.

But yes, more examples are planned, and I’m aware of the value of documentation.

As for providing full examples when someone asks something on the forum, there’s only so many hours in my day, and answering every question with a full-fledged tutorial is not going to be realistic.

2 Likes