5 ms·
Reminds me of Paredit, an emacs mode for structural code editing and navigation for lisps. It keeps the parse tree valid even as you do crazy stuff. http://dan
by code_biologist 5y ago
Reminds me of Paredit, an emacs mode for structural code editing and navigation for lisps. It keeps the parse tree valid even as you do crazy stuff.
http://danmidwood.com/content/2014/11/21/animated-paredit.html http://danmidwood.com/content/2014/11/21/animated-paredit.ht...
- josteink 5y agoWas looking for this exact comment. I’m honestly waiting for a tree-sitter (or LSP) based paredit-mode to show up, so that I can use it for all modes and languages, and not just LISP.
- hk__2 5y agoParedit is really great, and has been adapted to other editors as well. Writing Clojure in IntelliJ with Cursive and Paredit mode is really pleasant.
- jhgb 5y agoYep, Paredit was my first thought as well.
- dm_0ney 5y agoYeah slurping and barfing in Paredit are quite similar to basic restructuring operations in tylr, eg selecting a parenthesis and moving it somewhere else. Some differences: (1) In tylr you move the parenthesis itself, rather than making the parenthesized term slurp/barf its neighbors. This may seem like a minor difference for simple operations like this but I think it's an important primitive UI metaphor that makes the editing experience feel more direct/linear/text-like rather than you having to translate your editing goal into operations on the AST. (2) tylr generalizes beyond S-expressions to infix operator sequences and other multi-sorted syntactic forms (eg it understands you shouldn't be able to move expression forms in patterns). (3) tylr generalizes beyond parenthesis moving to near-arbitrary range selection moving, eg I could make the selection (specified by the square brackets) `( 1 + 2[) * (]3 + 4 )` and directly move it over to give `( 1[) * (]_ + 2 + 3 + 4 )` (where tylr has inserted a hole `_` to keep things well-formed)
- publicola1990 5y agoSmartparens is another emacs mode for structural editing as well.