Building a Nice syntax editor for dsl
Hi,
I have a dsl and I'm deciding how to build an editor. From scratch, xtext, mps... I would like to have a text editor, with syntax highlighting, code completion, drop down code completion, and a linked graphical view of the dsl.
In exploring MPS, I've done the calculator demo, and played around with the Robot project.
I don't know if I'm missing something, but the projectional syntax editors that are generated are not very user friendly. For example, with the Robot syntax, I can't simply mouse select a big block of text(syntax) and delete it, although in the tutorial video, it looks like he does this. Is this what you end up with?
MPS seems like a lot of work to learn, and it may be worth it, but if I end up with editors that are very hard for my users to use, then I'm not sure I want to do that. I would expect that my users will want to mouse over portions of our dsl to highlight and delete portions.
I would rather have an editor like intellij for my dsl, that works great, has syntax highlighting, code completion, and drop down completion. But that still understands the basic operations of text editing that users expect.
Please help me to understand the big picture here, and point me in the right direction.
thanks,
j
I have a dsl and I'm deciding how to build an editor. From scratch, xtext, mps... I would like to have a text editor, with syntax highlighting, code completion, drop down code completion, and a linked graphical view of the dsl.
In exploring MPS, I've done the calculator demo, and played around with the Robot project.
I don't know if I'm missing something, but the projectional syntax editors that are generated are not very user friendly. For example, with the Robot syntax, I can't simply mouse select a big block of text(syntax) and delete it, although in the tutorial video, it looks like he does this. Is this what you end up with?
MPS seems like a lot of work to learn, and it may be worth it, but if I end up with editors that are very hard for my users to use, then I'm not sure I want to do that. I would expect that my users will want to mouse over portions of our dsl to highlight and delete portions.
I would rather have an editor like intellij for my dsl, that works great, has syntax highlighting, code completion, and drop down completion. But that still understands the basic operations of text editing that users expect.
Please help me to understand the big picture here, and point me in the right direction.
thanks,
j
Please sign in to leave a comment.
When you need to develop or use several languages that integrate with and extend each other, then you will quickly find Xtext limiting for your use case. Most extension scenarios you can fake pretty well in Xtext, although sometimes it takes significantly more work. But one thing you can't do is extend languages that weren't designed with extension in mind. This is totally possible (and in most cases rather easy) with MPS through annotations, and this capability only works because of the way MPS edits the AST directly through the projectional editor. It's a powerful - and addictive - feature. Once you start realizing the real power of being able to do this, you'll find more and more uses for it, and it's pretty hard to go back.
I highly recommend Markus Voelter's new DSL book (I believe it's linked on the main MPS page). He goes into a great amount of detail on the pros/cons of both approaches, as well as many of the practical considerations for implementing various kinds of dsls.
Both Xtext and MPS are excellent products, and you can't go wrong with either one provided you do your homework up front and make sure you pick the one that best suits your needs. Creating a DSL can involve a significant investment of time, especially the first time around, so it's important to make sure you understand these tradeoffs and pick the right tool up front.
Can you answer my question of whether the projectional editors are working on my system. Are you able to select multiple nodes with your mouse as shown in the post above yours. I can't do that type of selection with my mouse, but in the demo videos, it appears he is making those types of selections. I understand that projectional editors are different to work with, I'm just trying to figure out how different.
Your system works fine! You cannot select the projected nodes with mouse like text. But you can select multiple statements from a list by using the keyboard with shift + up/down. This short cut works in most text editors, too.
I guess my question then is to Jetbrains. If multiple statements are selectable by various means, why would you leave out the most common way of multiple selecting. For any editor I create, a user will try using the mouse first.
And I would really not agree, that using the mouse is more useful than selecting things with the keyboard. In normal text editors I do the copy and paste actions just with the keyboard, since it is more precise. Just try the short cuts [Ctrl] + Shift + Cursor|Page up/down|Pos 1|End in a text editor. You can do things much faster than with a mouse if you are used to it.