3 ms·
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
by rybla 2y ago
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.
- layer8 2y agoFeatures 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.
- TuringTest 2y agoYou 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) https://en.wikipedia.org/wiki/Lapis_(text_editor) (Look at the links for an archived download page)
- schube 2y agoI 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.
- daotoad 2y agoI 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.
- 8n4vidtmkvmk 2y agoNo. 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.
- ivanjermakov 2y agoI utilize structural editing in nvim using some plugins: - treesitter-textobjects with powerful select and expand selection motions: https://github.com/nvim-treesitter/nvim-treesitter-textobjects https://github.com/nvim-treesitter/nvim-treesitter-textobjec... - sibling-swap fun name but does exactly that: https://github.com/Wansmer/sibling-swap.nvim 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/ https://tree-sitter.github.io/tree-sitter/