Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
gushogg-blake
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
151.
▲
by
gushogg-blake
5y ago
Thanks for the feedback! - can you move into an if/while if it's not already selected? For already selected blocks I've had it both ways and found it better to be able to drag from anywhere in the block - you can select a ch
152.
▲
by
gushogg-blake
5y ago
Yes, sort of, but they've always been added on top of a standard text editing interface so tend to be behind context menus (which is OK as they're also often high-level refactorings that aren't used that often). Treefrog
153.
▲
by
gushogg-blake
5y ago
Right - this is where I would use an LSP server
154.
▲
by
gushogg-blake
5y ago
Thanks - fixed
155.
▲
by
gushogg-blake
5y ago
Thanks! Error should be fixed now
156.
▲
by
gushogg-blake
5y ago
So things like classes and functions would be represented as files within a dir representing the actual file?
157.
▲
by
gushogg-blake
5y ago
Ah yeah, it's canvas based so I suppose it will be being scaled like an image. Thanks!
158.
▲
by
gushogg-blake
5y ago
Interesting! Yes, one of the main things I'm doing at the moment is thinking of and prototyping new commands and ways to represent code. I like the shell idea.
159.
▲
by
gushogg-blake
5y ago
Current langs are javascript, html and (s)css - there's a dropdown on the toolbar to create a new file in a given lang (the others there are partially supported, no Tree mode commands). The goal is to support all popular languages, as
160.
▲
by
gushogg-blake
5y ago
Thanks! Are you on a mac? Someone else noticed it on mac, just on the actual editor, so I thought it might be to do with rendering text on canvas (sometimes you have to use half-pixel coordinates to get things to align properly)
161.
▲
by
gushogg-blake
5y ago
I wonder if it was important that an actual abstract syntax tree was used? I'm realising the title might be a bit misleading - it should probably be "AST-inspired" commands, as the tree-sitter trees are technically concrete
162.
▲
by
gushogg-blake
5y ago
Thanks. Just checked and j/k are actually not implemented yet, so that explains that!
163.
▲
by
gushogg-blake
5y ago
It's more that the selection operates on whole lines in Tree mode, so it would parse fine with the tree-sitter grammar (for syntax highlighting etc) but selecting the inner contents of a block would take the block's closing ) with
164.
▲
by
gushogg-blake
5y ago
I'm not necessarily against it in the long term, just keeping all options open for now as I want to be able to work on it full time and that obviously involves making money somehow.
165.
▲
by
gushogg-blake
5y ago
Nice! One thing I thought ASTs weren't that good at was the initial writing of code - did you find that?
166.
▲
by
gushogg-blake
5y ago
:) I was surprised touchpad did anything tbh - turns out it sends wheel events with different deltaY/deltaX values, so I just had to use the actual values instead of what it was doing before (checking if < or > 0 and scrolling by
167.
▲
by
gushogg-blake
5y ago
Yeah, that's one of the main issues with ASTs and why I think they make the same mistake as text editors ultimately - designing around a particular data structure just constrains you into weird UX scenarios that don't have anythin
168.
▲
by
gushogg-blake
5y ago
One example would be turning a group of statements "xyz" into "if (some condition) then xyz, else (something else)" - with a text editing interface you have to think a bit about the exact text selection you want (or ente
169.
▲
by
gushogg-blake
5y ago
Yeah, tree-sitter and LSP are both steps in the right direction I think.
170.
▲
by
gushogg-blake
5y ago
Yeah using them as is and haven't had any issues so far. I think they are at a slightly lower level of abstraction than an AST, e.g. an async method in JS is a method_definition with an "async" node followed by a property_id
171.
▲
by
gushogg-blake
5y ago
Thanks! Yeah, I think of refactorings as being a level of abstraction above text and AST editing - kind of like macros for AST edits.
172.
▲
by
gushogg-blake
5y ago
Should be fixed now
173.
▲
by
gushogg-blake
5y ago
I haven't added any yet, but all parsing is done with tree-sitter so languages can be added pretty quickly. One issue is that tree mode works on whole lines (I think the benefit of AST-style navigation vs moving a text cursor diminish
174.
▲
by
gushogg-blake
5y ago
Thanks, I haven't tried it on a touchpad yet, will have a look.
175.
▲
by
gushogg-blake
5y ago
Backstory - I started experimenting with AST editing ideas after getting frustrated with my editor's lack of understanding of the structure and meaning of code, ie. the editing primitives all dealt with text and simple changes to the c
176.
▲
Treefrog: A code editor that uses both AST and text editing commands
(treefrog-editor.com)
114 points
by
gushogg-blake
5y ago
|
78 comments