Live data from Hacker News

Pantograph: A Fluid and Typed Structure Editor

github.com

11–20 of 26 posts

Re: Pantograph: A Fluid and Typed Structure Editor

#11
Would anyone use this for real programming, if it supported your favorite programming language? I know "supported" is a loaded word there, but just take that to mean: supports all the basic edits you need, in composition, to make any complex edit, but not fancy refactors or fancy language-specific stuff.

Re: Pantograph: A Fluid and Typed Structure Editor

#12

Super cool work! I'm always excited and a little terrified to see other people who share my sensibilities about which direction is forward in code editing : )

I'm taking my own stab at the same problem over in this org: https://github.com/bablr-lang/ . It makes my head spin seeing the problem domain expressed in such a different way!

Looks interesting, but I'm having trouble finding where to start reading about what's involved. Do you have a suggestion?

Re: Pantograph: A Fluid and Typed Structure Editor

#15
post #11

Would anyone use this for real programming, if it supported your favorite programming language? I know "supported" is a loaded word there, but just take that to mean: supports all the basic edits you need, in composition, to make any complex edit, but not fancy refactors or fancy language-specific stuff.

Features like the mentioned tree selection do make sense. But I prefer tools to be more like a library than a rigid framework. Give me the ability to perform powerful transformations, but don’t put me in a straightjacket that disallows non-well-formed intermediate states.

Re: Pantograph: A Fluid and Typed Structure Editor

#16
post #11

Would anyone use this for real programming, if it supported your favorite programming language? I know "supported" is a loaded word there, but just take that to mean: supports all the basic edits you need, in composition, to make any complex edit, but not fancy refactors or fancy language-specific stuff.

I absolutely would. I feel like the text editing ecosystem is slowly inching towards this anyway with incremental improvements:

- Thanks to formatters like gofmt and prettier when I edit code I can do so with exactly zero concern for spacing, new lines, alignment, indent, etc. Close to structure editors where, in my understanding, the way code is stored and the way it is presented may be completely independent.

- Mass-renaming like what is provided by LSPs and other refactoring tools also go in this direction of thinking about symbols and their identity, rather than their text name.

- Tree-sitter lets traditionally text-oriented tools be re-created to be structure-aware, for example difftastic for diffs or ast-grep for structured search-and-replace.

I didn’t quite understand how the structure editor shown here works with types though, and though I’d love to edit my Typescript in a structure editor that just couldn’t work if my inputs got delayed by the Typescript type system figuring things out. I would take enforced type correctness if it can be instant, but I’d still use structure editing without type awareness.

Re: Pantograph: A Fluid and Typed Structure Editor

#17
post #6

I like the idea. Reminds me of a talk about syntax editor in racket but I forget what it was named. What languages can pantograph support?

(ninth RacketCon): Andrew Blinn - Fructure: A Structured Editing Engine in Racket https://youtu.be/CnbVCNIh1NA?si=JZxjUdTLbBp6IEaK

Yes, this is it!! Thanks

Re: Pantograph: A Fluid and Typed Structure Editor

#20
post #12

Earlier quoted context omitted.

I'm taking my own stab at the same problem over in this org: https://github.com/bablr-lang/ . It makes my head spin seeing the problem domain expressed in such a different way!

Looks interesting, but I'm having trouble finding where to start reading about what's involved. Do you have a suggestion?

I keep trying to write docs but then I also keep making them out of date. The idea is that instead of each author of a tool like Pantograph building its own system of language support, (with each language author having to build support for each tool) our hope was that we could design some set of data structures, APIs, and capabilities which would allow a proper frontend/backend divide between languages and the the tools which consume their definitions.

The best place to get started is to see how CSTML works in the playground: https://bablr.org/playground. It's meant to be a self-describing format. It can be streamed, and we have a btree-backed storage format for it that makes incremental editing of immutable trees a breeze.

Post reply on HN