7 ms·
While I understand that it is useful to have semantic information (nothing stops Zed from having it from what I can see in its mode files which use ace-editor's
by scriptdevil 12y ago
While I understand that it is useful to have semantic information (nothing stops Zed from having it from what I can see in its mode files which use ace-editor's modes currently), I don't really think a code-editor needs to come with semantic information for all languages it supports. I don't know if that is even possible in a generic way. I mean, the behaviour of scope itself isn't generic. There are dynamic-scoped languages (like elisp) vs block-scoped languages (Java) vs function-scoped languages (JavaScript) which are all syntax-highlighted by most popular editors. I would relegate such work to heavier IDEs.
- drdaeman 12y agoWell, my point is not that multi-language code editor must provide semantic information for every language it can edit (that's just infeasible), but that editor's core must be designed with semantics in mind. I.e., not "well, it's text and core has no idea what it is but plugins are free to do anything with that", but "well, core has no idea what that 'typeclass' thingy code analyzer says it is, but it's happy to keep track of it and provide standard interfaces to use this info so maybe highlighter or code folding parts would figure out how to use that information" Then you could start with regexp mess-based parser that provides very basic understanding of the code and replace it with something that gives better code insight at later time, without rewriting the rest. And have generic refactoring module that can operate on many languages just by knowing about names and their possible scopes (whatever scoping type language is, in common cases I believe that still could be reduced to "in this text region").
- mietek 12y agoYou nailed it. Do you know of any editors which work this way, except emacs?
- drdaeman 12y agoUnfortunately, not many. I've heard LightTable is doing something like this, but never had a time to properly evaluate it and see for myself. Also, JetBrains' IDEs (IntelliJ IDEA, PyCharm, etc.) are notorious to have good understanding of code semantics, both out of the box and through plugin system.