Live data from Hacker News

Pantograph: A Fluid and Typed Structure Editor

github.com

21–26 of 26 posts

Re: Pantograph: A Fluid and Typed Structure Editor

#21
post #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.

You might enjoy the experimental editor Lapis.

This Pantograph somewhat reminds me of that lightweight structure editor, though Lapis is able to find regularities on the fly without a need to follow a perfect tree structure, just by finding bottom-up syntax of language elements (mostly HTML and basic data types).

https://en.wikipedia.org/wiki/Lapis_(text_editor) (Look at the links for an archived download page)

Re: Pantograph: A Fluid and Typed Structure Editor

#22
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 could see something like this operating like a WYSWYG HTML editor that either has a split screen or toggles between source and rendered views.

I think creating any sizable chunk of code in something like this would be likely to involve way too much clicking around.

But I can also see that it could be a really useful way to spot errors and a big help with refactoring tasks.

Re: Pantograph: A Fluid and Typed Structure Editor

#23
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.

No. I believe it was JetBrains that released a product like this years ago. I tried it briefly. Didn't like it.

Anything that even gets slightly in the way of my text is a big nuisance. Visual Studio likes to add their "Lenses" which may offer some OK information but it mucks up the vertical spacing so I have to disable it. The inlay type hints that some editors have is also great info but again, it just messes with my cursor positioning. And now we have all the LLM stuff -- the "ghost" text after my cursor I can mostly handle, particularly if its 1 line, but when it goes back and strikes out parts of my code that its suggesting I delete/refactor, it can get confusing. It is incredibly useful when it's correct though so depending on how much I trust it, I might tab to Accept and then try to make heads and tails of what it actually wrote.

These structured texts get in the way of copying and pasting and all kinds of stuff. I want to be able to find and replace with regexes, drop a cursor onto every line and just start typing (sometimes I copy and paste code into PLAINTEXT mode so that the editor doesn't try to get too clever while I'm doing a gross refactor).

I don't think I could get used to this. And I don't think I care if my code is momentarily uncompilable. Modern IDEs recover from errors pretty well. C++ can be a little slow to reparse after a refactor unfortunately, but I somehow don't think C++ inside a structured editor would be better.

Re: Pantograph: A Fluid and Typed Structure Editor

#25
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 utilize structural editing in nvim using some plugins:

- treesitter-textobjects with powerful select and expand selection motions: https://github.com/nvim-treesitter/nvim-treesitter-textobjec...

- sibling-swap fun name but does exactly that: https://github.com/Wansmer/sibling-swap.nvim

Both use Tree-sitter for AST provision and you can use it with any popular language or even write your own parser: https://tree-sitter.github.io/tree-sitter/

Post reply on HN